Kubernetes - uid : unable to do port forwarding: socat not found

Kubernetes port forwarding feature can be used to access a pod port from local machine without accessing pod. This can be achieved by other means like creating service. But port forwarding is somewhat quick.

Port forwarding can be enabled by running following command:

kubectl port-forward <pod Name> <local port>: <pod port>

e.g., kubectl port-forward my-pod 9000:80

I have a test  k8s cluster with single master node and two worker nodes. I have enabled port forward by using above command and invoked curl by opening another ssh session from master node.

vagrant@master-1:~$ curl http://localhost:9000

curl: (52) Empty reply from server

I was expecting some output but got “Empty reply from server”. Also observed, in ssh session where port forwarding is enabled, below error message.

E0811 13:51:54.597132   13384 portforward.go:391] an error occurred forwarding 9000 -> 80: error forwarding port 80 to pod ce0a72c043baa73a773b0803c9b3dc365229e94a0cb677d10963debc2c3f88b3, uid : unable to do port forwarding: socat not found.

I searched internet for “unable to do port forwarding: socat not found”. As per suggestion, I have installed socat in master node but error didn’t go away. After trying multiple other options, I installed socat on node where pod was running. I started to get response from pod after installing socat on worker node. My understanding from this is that, Kubernetes uses socat on worker node for forwarding requests from local machine to worker node.

Comments

Popular posts from this blog

HOW WE REDUCED SOA OSB PROVISIONING FROM 4 DAYS TO 4 HOURS

NOT ABLE TO START RABBITMQ CLUSTER: CANNOT DECLARE A QUEUE ‘~S’ ON NODE ‘~S’: ~255P

SOA SUITE 12.2.1.4 INSTALLATION: GOT EXCEPTION WHEN AUTO CONFIGURING THE SCHEMA COMPONENT(S) WITH DATA OBTAINED FROM SHADOW TABLE