<p>Below given the config, I am trying to deploy on Google Kubernetes Engine. But after deployment, I can't access the service on the ingress external IP. </p>

<p>I can access the service if I do:</p>

<pre><code>$ kubectl exec POD_NAME
# curl GET localhost:6078/todos
</code></pre>

<p>But I can't access it through ingress. GKE UI show errors like:</p>

<ul>
<li>Error during sync: error while evaluating the ingress spec: could not find service "default/todo"</li>
</ul>

<p>OR</p>

<ul>
<li>Some backend services are in UNHEALTHY state</li>
</ul>

<p>Even though the backend pod is up and running.</p>

<p>I believe there is something wrong with the service. </p>

<pre><code>---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: todo
  labels:
    app: todo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: todo
  template:
    metadata:
      labels:
        app: todo
    spec:
      containers:
        - image: eu.gcr.io/xxxxx/todo
          name: todo
          ports:
            - containerPort: 6078
              protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
  name: todo
  labels:
    app: todo
spec:
  type: NodePort
  ports:
    - port: 6078
  selector:
    app: todo
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: todo-ingress
spec:
  rules:
  - http:
  paths:
  - path: /*
    backend:
      serviceName: todo
      servicePort: 6078
</code></pre>

Jahid Shohel
<p>Hard to tell without knowing what 'todo' does, but there's a few things:</p>

<ol>
<li><p>There's an indentation error on the Ingress definition. I'm not sure if it's typo or it didn't get applied:</p>

<p>Instead, it should be something:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: todo-ingress
spec:
  rules:
  - http:
      paths:
      - path: /*
        backend:
          serviceName: todo
          servicePort: 6078
</code></pre></li>
<li><p>If you really want <code>/*</code> with no <code>host</code> then the default backend is overriding you, since it's the last rule in the <code>nginx.conf</code>, so you might as well configure:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: todo-ingress
spec:
  backend:
    serviceName: todo
    servicePort: 6078
</code></pre></li>
<li><p>Is your service binding to <code>0.0.0.0</code> and not <code>127.0.0.1</code>. Listening to on <code>127.0.0.1</code> will cause it to serve locally in the pod but not to any service outside.</p></li>
</ol>
