I\'m having some trouble getting the Nginx ingress controller working in my Kubernetes cluster. I have created the nginx-ingress deployments, services, roles, etc., according to
Another situation when it may happen is when ingress class of the ingress controller does not match ingress class in the ingress resource manifest used for your services.
Nginx installation command, short example:
helm install stable/nginx-ingress \
--name ${INGRESS_RELEASE_NAME} \
--namespace ${K8S_NAMESPACE} \
--set controller.scope.enabled=true \
--set controller.scope.namespace=${K8S_NAMESPACE} \
--set controller.ingressClass=${NGINX_INGRESS_CLASS}
ingress resource spec. , excerpt:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
labels:
annotations:
# folowing line is not valid for K8s or Helm,
# but reflects the values must be the same
kubernetes.io/ingress.class: ${NGINX_INGRESS_CLASS}
I discovered what I was doing wrong. In my application definition I was using name
as my selector
selector:
matchLabels:
name: hello-world
template:
metadata:
labels:
name: hello-world
Whereas in my service I was using app
selector:
app: hello-world
After updating my service to use app
, it worked
selector:
matchLabels:
app: hello-world
template:
metadata:
labels:
app: hello-world