I'm using kubernet to deploy my application: Here's my service description:

apiVersion: extensions/v1beta1
kind: Deployment
  name: flaskgql
    name: flaskgql
  replicas: 1
        name: flaskgql
      - name: flaskgql
        image: cryptodraco/flask_gql
        imagePullPolicy: IfNotPresent
        - containerPort: 8080
          - name: secrets
            mountPath: /etc/secrets
            readOnly: true
      - name: secrets
          secretName: db-passwords

apiVersion: v1
kind: Service
  name: flaskgql
    name: flaskgql
  type: LoadBalancer
  - port: 80
    targetPort: 8080
    name: flaskgql

When I list my services, everythings is fine:

flaskgql  LoadBalancer   80:30677/TCP   6m

And my docker file is as follow:

FROM gcr.io/google_appengine/python

RUN virtualenv /env

# source venv/bin/activate
ENV PATH /env/bin:$PATH

ADD requirements.txt /app/requirements.txt
RUN pip install -r /app/requirements.txt

# no database - SQL only

ADD . /app

CMD gunicorn -b :$PORT wsgi:app

But when I try to access my assigned static ip, it is not working. Note: I have already done the same thing before and it was ok. But now when I access the static ip, I get a 404error. Seems like my gunicorn server is not port forwarded to the ip. Even if from gcloud I get: enter image description here

I don't know if it is because I should stick the VM instead of the instance. But all I know is that it is not working and I have no idea how to debug that. Thanks in advance


To begin with, 404 not found implies that the request is making to the intended server but is unable to locate the requested file, I doubt this is an issue with the Static IP.

There are a few things you can do to debug this. The first step is to SSH into one of your nodes and try to connect to the pod directly using the cluster IP:

List your pods along with their CLuster IP

kubectl get pods -o wide

SSH into one of your cluster's nodes either through the GCP Console or using gcloud command

gcloud compute instances ssh [node_name]

Once you are connected to the node, run a curl command to see if your container is answering to requests properly

curl [pod_cluster_ip]

If this returns a 404 error message, it means that there is an issue with your container image. Either there are no files in the root of the server or the docker image has not exposed port 80.

If this test works, you know the container is serving correctly so there might be an issue with the service.

Repeat the curl test using the LB service cluster IP.

You can also attach to the pod to watch for activity

kubectl attach [pod_name] -i

Lastly, you can check the GCP Load Balancer to see if there are any reported errors there such as unhealthy backends.

I'm not as good with dockerfiles, but the k8s yaml look good

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.