<p>I am trying to deploy a simple app on google cloud. I am testing the gitlab kluster integration.
Here is my yaml k8:</p>
<pre><code>---
apiVersion: v1
kind: Service
metadata:
  name: service
  namespace: &quot;my-service&quot;
  labels:
    run: service
spec:
  type: NodePort
  selector:
    run: &quot;service&quot;
  ports:
  - port: 9000
    targetPort: 9000
    protocol: TCP
    name: http

---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: service-api
  namespace: &quot;my-service&quot;
  labels:
    run: service

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: service-v1
  namespace: &quot;my-service&quot;
  labels:
    run: service
spec:
  replicas: 1
  selector:
    matchLabels:
      run: service
  template:
    metadata:
      labels:
        run: service
    spec:
      serviceAccountName: service-api
      containers:
        - name: service
          image: &quot;gcr.io/test/service:latest&quot;
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 9000
              protocol: TCP
          volumeMounts:
            - name: test
              mountPath: /usr/test
      volumes:
        - name: test
          emptyDir: {}

---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: &quot;service-ingress&quot;
  namespace: &quot;my-service&quot;
  labels:
    run: service
spec:
  rules:
  - http:
      paths:
      - path: /*
        backend:
          serviceName: service
          servicePort: 9000
</code></pre>
<p>If I log into the pod I can curl the service on the nodePort designed IP, but if I try to hit the ingress address I just get a error:</p>
<p>I am not sure why there are 2 backend services on the loadbalancer that is created automatically, the one that points to my app shows as unhealthy</p>
<p>[load balancer backends<a href="https://i.stack.imgur.com/GakRc.png" rel="nofollow noreferrer">1</a></p>

tiago arruda
<p>You need to define <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/" rel="nofollow noreferrer">readiness probe</a> in your pod spec because GKE ingress controller picks up health check from the readiness probe.</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: service-v1
  namespace: &quot;my-service&quot;
  labels:
    run: service
spec:
  replicas: 1
  selector:
    matchLabels:
      run: service
  template:
    metadata:
      labels:
        run: service
    spec:
      serviceAccountName: service-api
      containers:
        - name: service
          image: &quot;gcr.io/test/service:latest&quot;
          imagePullPolicy: IfNotPresent
          readinessProbe:
            httpGet:
              path: /healthz
              port: 8080
            initialDelaySeconds: 3
            periodSeconds: 3
          ports:
            - containerPort: 9000
              protocol: TCP
          volumeMounts:
            - name: test
              mountPath: /usr/test
      volumes:
        - name: test
          emptyDir: {}
</code></pre>
