Skip to content

K8S ingress rule fails to match Exact / #10631

@saffih

Description

@saffih

Using Pattern to catch Exact /:
│app.kubernetes.io/name: rke2-ingress-nginx │app.kubernetes.io/version: 1.6.4 │helm.sh/chart: rke2-ingress-nginx-4.5.201
Having an ingress with:
│ rules:
│ - http:
│ paths:
│ - backend:
│ service:
│ name: powerflex-status-ui
│ port:
│ number: 80
│ path: /
│ pathType: Exact
When calling:
curl -k -H 'Cache-Control: no-cache, no-store' -I ​https://100.68.80.54/
HTTP/2 404
It should have returned 200 - it fails to match a single /
It worked with an older version. We have a workaround, adding $ to the expression.

WORKAROUND: That one seems identical but it works - getting http 200 by using: Exact /$
│ rules:
│ - http:
│ paths:
│ - backend:
│ service:
│ name: powerflex-status-ui
│ port:
│ number: 80
│ path: /$
│ pathType: Exact

** Expected 200 **:

The parsing with Exact is not good - a minor bug and we have a workaround by changing the expression:
/$
It should behave the same with \ vs. $

NGINX Ingress controller version (exec into the pod and run nginx-ingress-controller --version.):


NGINX Ingress controller
Release: nginx-1.6.4-hardened4
Build: git-90e1717ce
Repository: https://github.com/rancher/ingress-nginx.git
nginx version: nginx/1.21.4


Kubernetes version (use kubectl version):
1.26.4+rke2r1

Environment:

  • Cloud provider or hardware configuration:
  • OS (e.g. from /etc/os-release):

NAME="SLES"
VERSION="15-SP4"
VERSION_ID="15.4"
PRETTY_NAME="SUSE Linux Enterprise Server 15 SP4"
ID="sles"
ID_LIKE="suse"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:15:sp4"
DOCUMENTATION_URL="https://documentation.suse.com/"

  • Kernel (e.g. uname -a):
    Linux sn-451-vm51 5.14.21-150400.24.81-default Basic structure  #1 SMP PREEMPT_DYNAMIC Tue Aug 8 14:10:43 UTC 2023 (90a74a8) x86_64 x86_64 x86_64 GNU/Linux
  • Install tools:

    • Please mention how/where was the cluster created like kubeadm/kops/minikube/kind etc.
  • Basic cluster related info:

    • kubectl version

WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short. Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:"1", Minor:"26", GitVersion:"v1.26.4+rke2r1", GitCommit:"f89670c3aa4059d6999cb42e23ccb4f0b9a03979", GitTreeState:"clean", BuildDate:"2023-04-12T18:32:51Z", GoVersion:"go1.19.8 X:boringcrypto", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v4.5.7
Server Version: version.Info{Major:"1", Minor:"26", GitVersion:"v1.26.4+rke2r1", GitCommit:"f89670c3aa4059d6999cb42e23ccb4f0b9a03979", GitTreeState:"clean", BuildDate:"2023-04-12T18:32:51Z", GoVersion:"go1.19.8 X:boringcrypto", Compiler:"gc", Platform:"linux/amd64"}

  • kubectl get nodes -o wide

NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
sn-451-vm51 Ready control-plane,etcd,master 30h v1.26.4+rke2r1 100.68.80.51 SUSE Linux Enterprise Server 15 SP4 5.14.21-150400.24.81-default containerd://1.6.19-k3s1
sn-451-vm52 Ready control-plane,etcd,master 30h v1.26.4+rke2r1 100.68.80.52 SUSE Linux Enterprise Server 15 SP4 5.14.21-150400.24.81-default containerd://1.6.19-k3s1
sn-451-vm53 Ready control-plane,etcd,master 30h v1.26.4+rke2r1 100.68.80.53 SUSE Linux Enterprise Server 15 SP4 5.14.21-150400.24.81-default containerd://1.6.19-k3s1

  • How was the ingress-nginx-controller installed:
    • If helm was used then please show output of helm ls -A | grep -i ingress

rke2-ingress-nginx kube-system 3 2023-11-07 12:28:40.371153914 +0000 UTC deployed rke2-ingress-nginx-4.5.201 1.6.4

/label rke2

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.needs-priorityneeds-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions