kubernetes / ingress-nginx

Ingress NGINX Controller for Kubernetes
https://kubernetes.github.io/ingress-nginx/
Apache License 2.0
17.54k stars 8.26k forks source link

Error from server (NotFound): services "nginx-ingress-nginx-ingress" not found #11171

Closed rcbandit111 closed 7 months ago

rcbandit111 commented 7 months ago

I'm trying to implement the solution from this tutorial on Kubernetes v1.29.2:

https://platform9.com/learn/v1.0/tutorials/nginix-controller-helm

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

root@node1:~# POD_NAMESPACE=ingress-nginx
POD_NAME=$(kubectl get pods -n $POD_NAMESPACE -l app.kubernetes.io/name=ingress-nginx --field-selector=status.phase=Running -o jsonpath='{.items[0].metadata.name}')

kubectl exec -it $POD_NAME -n $POD_NAMESPACE -- /nginx-ingress-controller --version
error: error executing jsonpath "{.items[0].metadata.name}": Error executing template: array index out of bounds: index 0, length 0. Printing more information for debugging the template:
        template was:
                {.items[0].metadata.name}
        object given to jsonpath engine was:
                map[string]interface {}{"apiVersion":"v1", "items":[]interface {}{}, "kind":"List", "metadata":map[string]interface {}{"resourceVersion":""}}

error: pod, type/name or --filename must be specified
root@node1:~#

Kubernetes version (use kubectl version):

root@node1:~# kubectl version
Client Version: v1.29.2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.2
root@node1:~#

Environment:

Linux node1 6.1.0-9-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.27-1 (2023-05-08) x86_64 GNU/Linux

root@node1:~# kubectl version
Client Version: v1.29.2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.2
root@node1:~# kubectl get nodes -o wide
NAME    STATUS   ROLES           AGE   VERSION   INTERNAL-IP     EXTERNAL-IP   OS-IMAGE                         KERNEL-VERSION        CONTAINER-RUNTIME
node1   Ready    control-plane   20d   v1.29.2   37.221.93.109   <none>        Debian GNU/Linux 12 (bookworm)   6.1.0-9-cloud-amd64   containerd://1.7.13
node2   Ready    <none>          20d   v1.29.2   37.114.63.75    <none>        Debian GNU/Linux 12 (bookworm)   6.1.0-9-cloud-amd64   containerd://1.7.13
root@node1:~#
root@node1:~# helm ls -A | grep -i ingress
nginx-ingress                                   default         1               2024-03-27 15:00:56.721532805 +0000 UTC deployed        nginx-ingress-1.2.0                             3.5.0
root@node1:~#
root@node1:~# kubectl describe ingressclasses
Name:         nginx
Labels:       app.kubernetes.io/instance=nginx-ingress
              app.kubernetes.io/managed-by=Helm
              app.kubernetes.io/name=nginx-ingress
              app.kubernetes.io/version=3.5.0
              helm.sh/chart=nginx-ingress-1.2.0
Annotations:  meta.helm.sh/release-name: nginx-ingress
              meta.helm.sh/release-namespace: default
Controller:   nginx.org/ingress-controller
Events:       <none>
root@node1:~#

How to reproduce this issue:

    root@node1:~# helm repo add nginx-stable https://helm.nginx.com/stable
    "nginx-stable" has been added to your repositories
    root@node1:~# helm repo update
    Hang tight while we grab the latest from your chart repositories...
    ...Successfully got an update from the "nginx-stable" chart repository
    Update Complete. ⎈Happy Helming!⎈
    root@node1:~# helm install nginx-ingress nginx-stable/nginx-ingress --set rbac.create=true
    NAME: nginx-ingress
    LAST DEPLOYED: Wed Mar 27 15:00:56 2024
    NAMESPACE: default
    STATUS: deployed
    REVISION: 1
    TEST SUITE: None
    NOTES:
    NGINX Ingress Controller 3.5.0 has been installed.

    For release notes for this version please see: https://docs.nginx.com/nginx-ingress-controller/releases/

    Installation and upgrade instructions: https://docs.nginx.com/nginx-ingress-controller/installation/installing-nic/installation-with-helm/
    root@node1:~# kubectl get pods --all-namespaces -l app=nginx-ingress-nginx-ingress
    No resources found
    root@node1:~#
    root@node1:~# kubectl get pods --all-namespaces -l app=nginx-ingress-nginx-ingress
    No resources found
    root@node1:~#
    root@node1:~# kubectl get services nginx-ingress-nginx-ingress
    Error from server (NotFound): services "nginx-ingress-nginx-ingress" not found
    root@node1:~#
    root@node1:~# kubectl get pods
    NAME                                                       READY   STATUS    RESTARTS   AGE
    nginx-ingress-controller-55b595c97-ljtlh                   1/1     Running   0          37m
    root@node1:~#
    root@node1:~#  kubectl logs nginx-ingress-controller-55b595c97-ljtlh
    NGINX Ingress Controller Version=3.5.0 Commit=2c2fba3bda3b1bdc76455125031308fda3cc4eab Date=2024-03-20T09:55:44Z DirtyState=false Arch=linux/amd64 Go=go1.22.1
    I0327 15:01:13.818970       1 flags.go:316] Starting with flags: ["-nginx-plus=false" "-nginx-reload-timeout=60000" "-enable-app-protect=false" "-enable-app-protect-dos=false" "-nginx-configmaps=default/nginx-ingress" "-ingress-class=nginx" "-health-status=false" "-health-status-uri=/nginx-health" "-nginx-debug=false" "-v=1" "-nginx-status=true" "-nginx-status-port=8080" "-nginx-status-allow-cidrs=127.0.0.1" "-report-ingress-status" "-external-service=nginx-ingress-controller" "-enable-leader-election=true" "-leader-election-lock-name=nginx-ingress-leader" "-enable-prometheus-metrics=true" "-prometheus-metrics-listen-port=9113" "-prometheus-tls-secret=" "-enable-service-insight=false" "-service-insight-listen-port=9114" "-service-insight-tls-secret=" "-enable-custom-resources=true" "-enable-snippets=false" "-include-year=false" "-disable-ipv6=false" "-enable-tls-passthrough=false" "-enable-cert-manager=false" "-enable-oidc=false" "-enable-external-dns=false" "-default-http-listener-port=80" "-default-https-listener-port=443" "-ready-status=true" "-ready-status-port=8081" "-enable-latency-metrics=false" "-ssl-dynamic-reload=true" "-enable-telemetry-reporting=true" "-weight-changes-dynamic-reload=false"]
    I0327 15:01:13.833782       1 main.go:273] Kubernetes version: 1.29.2
    I0327 15:01:13.851672       1 main.go:418] Using nginx version: nginx/1.25.4
    I0327 15:01:13.912151       1 main.go:839] Pod label updated: nginx-ingress-controller-55b595c97-ljtlh
    2024/03/27 15:01:13 [notice] 16#16: using the "epoll" event method
    2024/03/27 15:01:13 [notice] 16#16: nginx/1.25.4
    2024/03/27 15:01:13 [notice] 16#16: built by gcc 12.2.0 (Debian 12.2.0-14)
    2024/03/27 15:01:13 [notice] 16#16: OS: Linux 6.1.0-9-cloud-amd64
    2024/03/27 15:01:13 [notice] 16#16: getrlimit(RLIMIT_NOFILE): 65535:65535
    2024/03/27 15:01:13 [notice] 16#16: start worker processes
    2024/03/27 15:01:13 [notice] 16#16: start worker process 17
    2024/03/27 15:01:13 [notice] 16#16: start worker process 18
    I0327 15:01:13.923049       1 listener.go:48] Starting prometheus listener on: :9113/metrics
    2024/03/27 15:01:13 [notice] 16#16: start worker process 19
    2024/03/27 15:01:13 [notice] 16#16: start worker process 21
    I0327 15:01:13.925612       1 leaderelection.go:250] attempting to acquire leader lease default/nginx-ingress-leader...
    2024/03/27 15:01:13 [notice] 16#16: start worker process 22
    2024/03/27 15:01:13 [notice] 16#16: start worker process 23
    I0327 15:01:13.970775       1 leaderelection.go:260] successfully acquired lease default/nginx-ingress-leader
    2024/03/27 15:01:14 [notice] 16#16: signal 1 (SIGHUP) received from 27, reconfiguring
    2024/03/27 15:01:14 [notice] 16#16: reconfiguring
    2024/03/27 15:01:14 [notice] 16#16: using the "epoll" event method
    2024/03/27 15:01:14 [notice] 16#16: start worker processes
    2024/03/27 15:01:14 [notice] 16#16: start worker process 28
    2024/03/27 15:01:14 [notice] 16#16: start worker process 29
    2024/03/27 15:01:14 [notice] 16#16: start worker process 30
    2024/03/27 15:01:14 [notice] 16#16: start worker process 31
    2024/03/27 15:01:14 [notice] 16#16: start worker process 32
    2024/03/27 15:01:14 [notice] 16#16: start worker process 33
    2024/03/27 15:01:14 [notice] 18#18: gracefully shutting down
    2024/03/27 15:01:14 [notice] 23#23: gracefully shutting down
    2024/03/27 15:01:14 [notice] 22#22: gracefully shutting down
    2024/03/27 15:01:14 [notice] 23#23: exiting
    2024/03/27 15:01:14 [notice] 21#21: gracefully shutting down
    2024/03/27 15:01:14 [notice] 19#19: gracefully shutting down
    2024/03/27 15:01:14 [notice] 19#19: exiting
    2024/03/27 15:01:14 [notice] 22#22: exiting
    2024/03/27 15:01:14 [notice] 22#22: exit
    2024/03/27 15:01:14 [notice] 19#19: exit
    2024/03/27 15:01:14 [notice] 23#23: exit
    2024/03/27 15:01:14 [notice] 21#21: exiting
    2024/03/27 15:01:14 [notice] 21#21: exit
    2024/03/27 15:01:14 [notice] 18#18: exiting
    2024/03/27 15:01:14 [notice] 18#18: exit
    2024/03/27 15:01:14 [notice] 17#17: gracefully shutting down
    2024/03/27 15:01:14 [notice] 17#17: exiting
    2024/03/27 15:01:14 [notice] 17#17: exit
    I0327 15:01:14.303262       1 event.go:364] Event(v1.ObjectReference{Kind:"ConfigMap", Namespace:"default", Name:"nginx-ingress", UID:"5e1951c2-d096-4480-a40b-3ebfc981f1e2", APIVersion:"v1", ResourceVersion:"3617113", FieldPath:""}): type: 'Normal' reason: 'Updated' Configuration from default/nginx-ingress was updated
    2024/03/27 15:01:14 [notice] 16#16: signal 17 (SIGCHLD) received from 22
    2024/03/27 15:01:14 [notice] 16#16: worker process 22 exited with code 0
    2024/03/27 15:01:14 [notice] 16#16: signal 29 (SIGIO) received
    2024/03/27 15:01:14 [notice] 16#16: signal 17 (SIGCHLD) received from 21
    2024/03/27 15:01:14 [notice] 16#16: worker process 17 exited with code 0
    2024/03/27 15:01:14 [notice] 16#16: worker process 21 exited with code 0
    2024/03/27 15:01:14 [notice] 16#16: signal 29 (SIGIO) received
    2024/03/27 15:01:14 [notice] 16#16: signal 17 (SIGCHLD) received from 18
    2024/03/27 15:01:14 [notice] 16#16: worker process 18 exited with code 0
    2024/03/27 15:01:14 [notice] 16#16: signal 29 (SIGIO) received
    2024/03/27 15:01:14 [notice] 16#16: signal 17 (SIGCHLD) received from 19
    2024/03/27 15:01:14 [notice] 16#16: worker process 19 exited with code 0
    2024/03/27 15:01:14 [notice] 16#16: signal 29 (SIGIO) received
    2024/03/27 15:01:14 [notice] 16#16: signal 17 (SIGCHLD) received from 23
    2024/03/27 15:01:14 [notice] 16#16: worker process 23 exited with code 0
    2024/03/27 15:01:14 [notice] 16#16: signal 29 (SIGIO) received
    E0327 15:07:01.756789       1 leaderelection.go:332] error retrieving resource lock default/nginx-ingress-leader: etcdserver: leader changed
    I0327 15:07:03.283380       1 leaderelection.go:285] failed to renew lease default/nginx-ingress-leader: timed out waiting for the condition
    root@node1:~#

Anything else we need to know:

Do you know why I get empty ingress controller?

k8s-ci-robot commented 7 months ago

This issue is currently awaiting triage.

If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
longwuyuan commented 7 months ago

That controller is a release from the company NGINX INC. and not from this project.

Both names have the word NGINX so the confusion happens often. Reach out in NGINX INC. forums.

/remove-kind bug /close

k8s-ci-robot commented 7 months ago

@longwuyuan: Closing this issue.

In response to [this](https://github.com/kubernetes/ingress-nginx/issues/11171#issuecomment-2024192536): >That controller is a release from the company NGINX INC. and not from this project. > >Both names have the word NGINX so the confusion happens often. Reach out in NGINX INC. forums. > >/remove-kind bug >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.