We established a Kubernetes cluster for a client approximately a year ago, which includes separate namespaces for staging and production environments. As we work on the next version of the application, we have introduced a new beta environment within its own namespace.
This Kubernetes cluster is deployed on bare metal and utilizes MetalLB for load balancing along with NGINX Ingress for routing. The NGINX Ingress controller was installed using Helm, and the ingress resources are defined in the following manifest (note that namespaces are managed by our deployment pipeline and are not explicitly shown in the manifest):
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: api-ingress
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/configuration-snippet: |
more_set_headers "X-Robots-Tag: noindex, nofollow";
nginx.ingress.kubernetes.io/enable-cors: "true"
nginx.ingress.kubernetes.io/cors-allow-methods: "GET, OPTIONS"
nginx.ingress.kubernetes.io/cors-allow-origin: "*"
nginx.ingress.kubernetes.io/cors-allow-credentials: "true"
spec:
tls:
- hosts:
- ${API_DOMAIN}
secretName: api-cert
rules:
- host: ${API_DOMAIN}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: api
port:
number: 80
Upon applying this manifest, we encountered the following error:
Error from server (InternalError): error when creating "STDIN": Internal error occurred: failed calling webhook "validate.nginx.ingress.kubernetes.io": Post https://ingress-nginx-controller-admission.ingress-nginx.svc:443/networking.k8s.io/v1/ingresses?timeout=30s: service "ingress-nginx-controller-admission" not found
To resolve this, I attempted to update the apiVersion in the ingress manifest to networking.k8s.io/v1, which is compatible with the current version of the NGINX Ingress controller installed via Helm. However, the same error persisted.
My initial hypothesis is that the issue may stem from changes in the NGINX Ingress controller since its installation a year ago, despite the ingress controllers being in separate namespaces. Unfortunately, I could not locate any services named ingress-nginx-controller-admission across my namespaces, leaving me uncertain about the next steps to take.