Connect from container to localhost

7/6/2020

I created a pod and try to connect from that pod to localhost. How is possible with the help of container arguments connect to localhost ?

-- O.Man
args
kubernetes

1 Answer

7/6/2020

You can always execute:

kubectl port-forward <pod-name> port:port

Check more here: https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/.

If you don't want to use port forwarding, then you need to expose your POD with a service. Read more here: https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/

-- RafaƂ Leszko
Source: StackOverflow