<p>I am trying to deploy Wordpress on GKE, everything is ok except the ingress, the ingress is not able to connect to backend service, showing &quot; SOME BACKEND SERVICES ARE IN UNHEALTHY STATE&quot;
I would be grateful if someone help me.</p>
<p><strong>Wordpress deployment yaml file</strong></p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: wordpress-deployment
  labels:
    app: wordpress
spec:
  replicas: 1
  selector:
    matchLabels:
      app: wordpress
  template:
    metadata:
      labels:
        app: wordpress
    spec:
      containers:
      - name: wordpress
        image: wordpress
        ports:
        - containerPort: 80
        volumeMounts:
          - name: wordpress-persistent-storage
            mountPath: /var/www/html
        env:
        - name: WORDPRESS_DB_HOST
          value: mysql-service
        - name: WORDPRESS_DB_USER
          value: wpuser
        - name: WORDPRESS_DB_PASSWORD
          value: pass@123
        - name: WORDPRESS_DB_NAME
          value: wpdb
        - name: WORDPRESS_DEBUG
          value: &quot;1&quot;
      volumes:
        - name: wordpress-persistent-storage
          persistentVolumeClaim:
            claimName: wordpress-volumeclaim

</code></pre>
<p><strong>Service yaml file</strong></p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: wordpress-service
spec:
  type: NodePort
  selector:
    app: wordpress
  ports:
  - name: portname
    nodePort: 30100
    port: 80
    targetPort: 80
    
</code></pre>
<p><strong>Ingress yaml file</strong></p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: wordpress-ingress
  annotations:
    kubernetes.io/ingress.global-static-ip-name: my-address
    networking.gke.io/managed-certificates: managed-cert
    kubernetes.io/ingress.class: &quot;gce&quot;
spec:
  rules:
    - host: example.com 
    - http:
        paths:
        - path: /
          pathType: Prefix
          backend:
            service:
              name: wordpress-service
              port:
                number: 80
                
</code></pre>
<p><a href="https://i.stack.imgur.com/sV5l5.jpg" rel="nofollow noreferrer">Ingress GCP Consol</a></p>
<p><a href="https://i.stack.imgur.com/cU8BI.jpg" rel="nofollow noreferrer">Ingress GCP Consol</a></p>
<p><a href="https://i.stack.imgur.com/iirhc.jpg" rel="nofollow noreferrer">GCP logs</a></p>

Noor Muradi
<p>You can try to go to <a href="https://console.cloud.google.com/compute/healthChecks/" rel="nofollow noreferrer">https://console.cloud.google.com/compute/healthChecks/</a> and then modify the health check for the wordpress backend. For example changing it from <code>/</code> to <code>/wp-admin/images/wordpress-logo.svg</code> solved the issue in my case. This is described in this post <a href="https://serverfault.com/questions/826719/how-to-create-a-url-in-a-wordpress-that-will-return-code-200">https://serverfault.com/questions/826719/how-to-create-a-url-in-a-wordpress-that-will-return-code-200</a>.</p>
