<p>Being completly new to google cloud, and almost new to kubernetes, I struggled my whole weekend trying to deploy my app in GKE.
My app consists of a react frontend, nodejs backend, postgresql database (connected to the backend with a cloudsql-proxy) and redis.</p>

<p>I serve the frontend and backend with an Ingress, everything seems to be working and all, my pods are running. The ingress-nginx exposes the endpoint of my app, but when when I open it, instead of seeing my app, I see blank page with a 200 response. And when I do <strong>kubectl logs MY_POD</strong>, I can see that my react app is running.</p>

<p>Ingress:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: superflix-ingress-service
  namespace: default
  annotations:
    kubernetes.io/ingress.class: nginx
    kubernetes.io/ingress.global-static-ip-name: "web-static-ip"
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
  rules:
  - http:
      paths:
      - path: /*
        backend:
          serviceName: superflix-ui-node-service
          servicePort: 3000
      - path: /graphql/*
        backend:
          serviceName: superflix-backend-node-service
          servicePort: 4000
</code></pre>

<p>Here is my backend:</p>

<pre><code>kind: Service
apiVersion: v1
metadata:
  name: superflix-backend-node-service
spec:
  type: NodePort
  selector:
    app: app
  ports:
  - port: 4000
    targetPort: 4000
    # protocol: TCP
    name: http
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: superflix-backend-deployment
  namespace: default
spec:
  replicas: 2
  template:
    metadata:
      labels:
        app: app
    spec:
      containers:
        - name: superflix-backend
          image: gcr.io/superflix-project/superflix-server:v6
          ports:
            - containerPort: 4000
          # The following environment variables will contain the database host,
          # user and password to connect to the PostgreSQL instance.
          env:
            - name: REDIS_HOST
              value: superflix-redis.default.svc.cluster.local
            - name: IN_PRODUCTION
              value: "true"
            - name: POSTGRES_DB_HOST
              value: "127.0.0.1"
            - name: POSTGRES_DB_PORT
              value: "5432"
            - name: REDIS_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: redis-env-secrets
                  key: REDIS_PASS
            # [START cloudsql_secrets]
            - name: POSTGRES_DB_USER
              valueFrom:
                secretKeyRef:
                  name: cloudsql-db-credentials
                  key: username
            - name: POSTGRES_DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: cloudsql-db-credentials
                  key: password
            # [END cloudsql_secrets]
        # [START proxy_container]
        - name: cloudsql-proxy
          image: gcr.io/cloudsql-docker/gce-proxy:1.11
          command: ["/cloud_sql_proxy",
                    "-instances=superflix-project:europe-west3:superflix-db=tcp:5432",
                    "-credential_file=/secrets/cloudsql/credentials.json"]
          # [START cloudsql_security_context]
          securityContext:
            runAsUser: 2  # non-root user
            allowPrivilegeEscalation: false
          # [END cloudsql_security_context]
          volumeMounts:
            - name: cloudsql-instance-credentials
              mountPath: /secrets/cloudsql
              readOnly: true
        # [END proxy_container]
      # [START volumes]
      volumes:
        - name: cloudsql-instance-credentials
          secret:
            secretName: cloudsql-instance-credentials
      # [END volumes]
</code></pre>

<p>And here is my frontend:</p>

<pre><code>kind: Service
apiVersion: v1
metadata:
  name: superflix-ui-node-service
spec:
  type: NodePort
  selector:
    app: app
  ports:
    - port: 3000
      targetPort: 3000
      # protocol: TCP
      name: http
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: superflix-ui-deployment
  namespace: default
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: app
    spec:
      containers:
        - name: superflix-ui
          image: gcr.io/superflix-project/superflix-ui:v4
          ports:
            - containerPort: 3000
          env:
            - name: IN_PRODUCTION
              value: 'true'
            - name: BACKEND_HOST
              value: superflix-backend-node-service
</code></pre>

<p>EDIT:</p>

<p>When I look at the stackdriver logs of my nginx-ingress-controller I have warnings:</p>

<blockquote>
  <p>Service "default/superflix-ui" does not have any active Endpoint.
  Service "default/superflix-backend" does not have any active Endpoint.</p>
</blockquote>

kurashima
<p>I actually found what was the issue. I changed the ingress service path from <strong>/*</strong> to <strong>/</strong>, and now it is working perfectly.</p>
