Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
153 views
in Technique[技术] by (71.8m points)

Need to do ssh to Kubernetes pod

Is it possible to take ssh to pod. eg: ssh pod_ip

I know we can do this with kubectl command. But I need to do ssh from my local linux machine where I doesn't have kubectl

Thanks

question from:https://stackoverflow.com/questions/45714658/need-to-do-ssh-to-kubernetes-pod

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Firstly, you have to ensure that the openssh-server has been installed and running in the pod. If not, you can use kubectl exec -it <pod-name> -n <namespace> -- bash to access the pod. If your pod are running Ubuntu, do apt-get install -y openssh-server.

Secondly, pods are running in a virtual IP subnet assigned by network service. They are accessible to any Master nodes and Worker nodes in the cluster. You can do ssh from any of the Host OS.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...