Pod is running but not able to connect

I have a pod running and when i try to access it using the cluster IP address and the nodeport port, it does not connect. I checked the status and its running. Checked further info using the describe keyword and it shows the pod in terminated state with the exit code 255

First question:

  • What are you running in the pod? Please post this in a code block
 like this
(use the </> button to create the block, and paste into the the block)

It also looks like the pod was crashlooping, not running due to Last State: Terminated, Restart Count: 4 and Exit Code: 255

This is my gitlab repo bilalahmed55 / Cicd · GitLab

I have created a pipeline to first build image of the project and then deploy it to the gitlab registry and then deploy the application on my local kubernetes cluster.

Here is the confusing part, when I run the pod without the secrets file (once the image is downloaded) the pod will run fine and also show output on the clusters ip and port.

You should never post secrets in a public repo. I can now access your docker registry!

ubuntu $ docker login registry.gitlab.com
Username: bilalahmed55
Password: 
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

I recommend you immediately change your password and remove the file from the repo.

1 Like

I apologize, changed the password and deleted the secrets file. I am new to gitlab and kubernetes and trying to learn while watching the kubernetes course

You don’t need to apologize! I merely pointed out how you were putting yourself at risk!

Kubernetes secrets aren’t secret!! They are simply base64 encoded text which is a symmetric encoding - an obfuscation if you like…

controlplane $ echo 'Hello World' | base64
SGVsbG8gV29ybGQK
controlplane $ echo 'SGVsbG8gV29ybGQK' | base64 -d
Hello World
controlplane $ 

All I had to do was take the encoded text in your secret and send it through base64 -d like above :slight_smile:

As for your application, you need to check in pod log (kubectl logs) and events (kubectl describe pod) to try to find the issue.

If you coded the node application, make sure that you console.log any error condition in the application no matter how insignificant you think it is, so that it shows up in pod logs

Well known exit codes reported by describe pod are listed here.

Follow the steps in my message above.