Port-forwarding fails on k8s gcp tutorial

1/17/2020

I’m k8s beginner, and struggling with below error.

E0117 18:24:47.596238   53015 portforward.go:400]
an error occurred forwarding 9999 -> 80: error forwarding port 80 to pod XXX,
uid : exit status 1: 2020/01/17 09:24:47 socat[840136] E connect(5, AF=2 127.0.0.1:80, 16): Connection refused

I don’t even know what the error stands for, needless to say for its cause. Does anyone know of which situation below error occurs?

This error is occuring while processing GCP's deployment manager tutorial according to tutorial project GCP provides.

https://github.com/GoogleCloudPlatform/deploymentmanager-samples/tree/master/examples/v2/gke

Error occurs when typing this command.

curl localhost:9999

Any ambiguous expression or extra information is required, please notify me. Thanks in advance!

-- Taruya
google-kubernetes-engine
kubernetes

1 Answer

1/17/2020

The error is telling you, that there's nothing listening to port 80 inside the pod. You should check the pod state:

kubectl get pods

It will also tell you which port(s) the pod (its containers) is listening to.

Maybe it has crashed. Also check the log of the pod:

kubectl logs <pod-name>

Btw. Google's Deployment Manager is a very special kind of a tool. Google itself suggests to use Terraform instead. It's nevertheless part of their certification exams.

-- HefferWolf
Source: StackOverflow