title: kubernetes ingress with gRPC and HTTP
body: <p>I have an application deployed to kubernetes (AKS) where I have a mix of gRPC and http services.  I initially added the route for a new gRPC service to the existing ingress which was previously serving only http.  That didn't work and digging into it, I read that we need to add the <code>nginx.ingress.kubernetes.io/backend-protocol: GRPC</code> annotation, and that it applied to all routes, so we would need two separate ingress.  I'm currently getting an exception <code>io.grpc.internal.ManagedChannelImpl$NameResolverListener</code> error trying to connect to the gRPC service with message <code>nodename nor servname provided, or not known</code>.  I'm guessing that though when multiple paths within an Ingress match a request, precedence is given first to the longest matching path, that doesn't apply across the both ingress.  So I would need to either use different hosts, or change the <code>/*</code> path so that it didn't also match <code>/results</code>?  Or is there something else that I need to change in my configuration?</p>
  <pre><code>apiVersion: networking.k8s.io/v1
  kind: Ingress
  metadata:
    name: {{ .Release.Name }}-{{ .Chart.Name }}-ingress
    annotations:
      kubernetes.io/ingress.class: nginx
      cert-manager.io/cluster-issuer: letsencrypt
  spec:
    tls:
    - hosts:
      - {{ .Values.ingress.hosts.host }}
      secretName: {{ .Values.ingress.tls.secretName }}
    rules:
    - host: {{ .Values.ingress.hosts.host }}
      http:
        paths:
        - path: /graphql
          pathType: Prefix
          backend:
            service:
              name: {{ .Release.Name }}-{{ .Values.services.graphqlServer.host }}
              port:
                number: 80
        - path: /graphql/*
          pathType: Prefix
          backend:
            service:
              name: {{ .Release.Name }}-{{ .Values.services.graphqlServer.host }}
              port:
                number: 80
        - path: /
          pathType: Prefix
          backend:
            service:
              name: {{ .Release.Name }}-{{ .Values.services.webUIServer.host }}
              port:
                number: 80
        - path: /*
          pathType: Prefix
          backend:
            service:
              name: {{ .Release.Name }}-{{ .Values.services.webUIServer.host }}
              port:
                number: 80
  ---
  apiVersion: networking.k8s.io/v1
  kind: Ingress
  metadata:
    name: {{ .Release.Name }}-{{ .Chart.Name }}-grpc
    annotations:
      kubernetes.io/ingress.class: nginx
      nginx.ingress.kubernetes.io/backend-protocol: GRPC
      nginx.ingress.kubernetes.io/ssl-redirect: &quot;true&quot;
      cert-manager.io/cluster-issuer: letsencrypt
  spec:
    tls:
    - hosts:
      - {{ .Values.ingress.hosts.host }}
      secretName: {{ .Values.ingress.tls.secretName }}
    rules:
    - host: {{ .Values.ingress.hosts.host }}
      http:
        paths:
        - path: /results
          pathType: Prefix
          backend:
            service:
              name: {{ .Release.Name }}-{{ .Values.services.externalResults.host }}
              port:
                number: 9000
  
  </code></pre>