Kubernetes Nginx Ingress not finding service endpoint

前端 未结 2 1463
渐次进展
渐次进展 2021-02-19 21:58

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

相关标签:
2条回答
  • 2021-02-19 22:20

    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}
    
    0 讨论(0)
  • 2021-02-19 22:30

    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
    
    0 讨论(0)
提交回复
热议问题