<p>I'm trying to deploy my Apollo Server application to my GKE cluster. However, when I visit the static IP for my site I receive a 502 Bad Gateway error. I was able to get my client to deploy properly in a similar fashion so I'm not sure what I'm doing wrong. My deployment logs seem to show that the server started properly. However my ingress indicates that my service is unhealthy since it seems to be failing the health check.</p>
<p>Here is my deployment.yml</p>
<pre><code>apiVersion: apps/v1

kind: Deployment

metadata:
  name: &lt;DEPLOYMENT_NAME&gt;
  labels:
    app: &lt;DEPLOYMENT_NAME&gt;

spec:
  replicas: 1
  selector:
    matchLabels:
      app: &lt;POD_NAME&gt;
  template:
    metadata:
      name: &lt;POD_NAME&gt;
      labels:
        app: &lt;POD_NAME&gt;
    spec:
      serviceAccountName: &lt;SERVICE_ACCOUNT_NAME&gt;
      containers:
        - name: &lt;CONTAINER_NAME&gt;
          image: &lt;MY_IMAGE&gt;
          imagePullPolicy: Always
          ports:
            - containerPort: &lt;CONTAINER_PORT&gt;
        - name: cloud-sql-proxy
          image: gcr.io/cloudsql-docker/gce-proxy:1.17
          command:
            - '/cloud_sql_proxy'
            - '-instances=&lt;MY_PROJECT&gt;:&lt;MY_DB_INSTANCE&gt;=tcp:&lt;MY_DB_PORT&gt;'
          securityContext:
            runAsNonRoot: true

</code></pre>
<p>My service.yml</p>
<pre><code>apiVersion: v1

kind: Service

metadata:
  name: &lt;MY_SERVICE_NAME&gt;
  labels:
    app: &lt;MY_SERVICE_NAME&gt;
  annotations:
    cloud.google.com/neg: '{&quot;ingress&quot;: true}'

spec:
  type: NodePort
  ports:
    - protocol: TCP
      port: 80
      targetPort: &lt;CONTAINER_PORT&gt;

  selector:
    app: &lt;POD_NAME&gt;

</code></pre>
<p>And my ingress.yml</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1

kind: Ingress

metadata:
  name: &lt;INGRESS_NAME&gt;
  annotations:
    kubernetes.io/ingress.global-static-ip-name: &lt;CLUSTER_NAME&gt;
    networking.gke.io/managed-certificates: &lt;CLUSTER_NAME&gt;

spec:
  rules:
    - http:
        paths:
          - path: /*
            backend:
              serviceName: &lt;SERVICE_NAME&gt;
              servicePort: 80
</code></pre>
<p>Any ideas what is causing this failure?</p>

Jest Games
<p>With Apollo Server you need the health check to look at the correct endpoint. So add the following to your deployment.yml under the container.</p>
<pre><code>livenessProbe:
  initialDelaySeconds: 30
  periodSeconds: 30
  httpGet:
    path: '/.well-known/apollo/server-health'
    port: &lt;CONTAINER_PORT&gt;
readinessProbe:
  initialDelaySeconds: 30
  periodSeconds: 30
  httpGet:
    path: '/.well-known/apollo/server-health'
    port: &lt;CONTAINER_PORT&gt;
</code></pre>
