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
But, Is it possible to SSH into a K8 Pod from outside the cluster? Yes.
If your endgoal is to get remote SSH access to your private Kubernetes cluster nodes or pods, then you have 2 options: Option# 1: Install and run an OpenSSH server inside your docker container pod. SSH server listens on port 22 and you need to expose that to the outside network.
Kubernetes nodes can be accessed similar way how we ssh into other linux machines. Just try ssh with the external ip of that node and you can login into it that way.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With