<blockquote>
  <p><strong>Kind Note:</strong> I have googled a lot and take a look too many questions related to this issue at StackOverflow also but couldn't solve my issue, that's why don't mark this as duplicate, please!</p>
</blockquote>

<p>I'm trying to deploy 2 services (One is Python flask and other is NodeJS) on Google Kubernetes Engine. I have created two Kubernetes-deployments one for each service and two Kubernetes-services one for each service of type <code>NodePort</code>. Then, I have created an Ingress and mentioned my <code>endpoints</code> but Ingress says that One backend service is <code>UNHEALTHY</code>.</p>

<p>Here are my Deployments YAML definitions:</p>

<pre><code># Pyservice deployment
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: pyservice
  labels:
    app: pyservice
  namespace: default
spec:
  selector:
    matchLabels:
        app: pyservice
  template:
    metadata:
      labels:
        app: pyservice
    spec:
      containers:
      - name: pyservice
        image: docker.io/arycloud/docker_web_app:pyservice
        ports:
        - containerPort: 5000
      imagePullSecrets:
         - name: docksecret

# # Nodeservice deployment
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: nodeservice
  labels:
    app: nodeservice
  namespace: default
spec:
  selector:
    matchLabels:
        app: nodeservice
  template:
    metadata:
      labels:
        app: nodeservice
        tier: web
    spec:
      containers:
      - name: nodeservice
        image: docker.io/arycloud/docker_web_app:nodeservice
        ports:
        - containerPort: 8080
      imagePullSecrets:
         - name: docksecret
</code></pre>

<p>And, here are my services and Ingress YAML definitions:</p>

<pre><code># pyservcie service
kind: Service
apiVersion: v1
metadata:
  name: pyservice
spec:
  type: NodePort
  selector:
    app: pyservice
  ports:
  - protocol: TCP
    port: 5000
    nodePort: 30001
---

# nodeservcie service
kind: Service
apiVersion: v1
metadata:
  name: nodeservcie
spec:
  type: NodePort
  selector:
    app: nodeservcie
  ports:
  - protocol: TCP
    port: 8080
    nodePort: 30002
---

# Ingress

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-ingress
  namespace: default
  annotations:
    kubernetes.io/ingress.class: "gce"
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - http:
      paths:
      - path: /
        backend:
          serviceName: pyservice
          servicePort: 5000
      - path: /*
        backend:
          serviceName: pyservice
          servicePort: 5000
      - path: /node/svc/
        backend:
          serviceName: nodeservcie
          servicePort: 8080
</code></pre>

<p>The <code>pyservice</code> is working fine but the <code>nodeservice</code> shows as <code>UNHEALTHY</code> backend. Here's a screenshot:
<a href="https://i.stack.imgur.com/avXev.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/avXev.jpg" alt="enter image description here"></a></p>

<p>Even I have edited the <code>Firewall Rules</code> for all <code>gke-....</code> and allow all ports just for getting out from this issue, but it still showing the <code>UNHEALTHY</code> status for <code>nodeservice</code>.</p>

<p>What's wrong here?</p>

<p>Thanks in advance!</p>

Abdul Rehman
<p>Why are you using a GCE ingress class and then specifying a nginx rewrite annotation? In case you haven't realised, the annotation won't do anything to the GCE ingress.</p>

<p>You have also got 'nodeservcie' as your selector instead of 'nodeservice'.</p>
