Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to SSH into a Kubernetes Node or Server

Tags:

How to SSH into a Kubernetes Node or Server hosted on AWS? I have hosted a Kubernetes Server and Node on AWS. I'm able to see the nodes and server from my local laptop with the kubectl get node command.

I need to create a persistent volume for my node but I'm unable to ssh into it.

Is there any specific way to ssh into the node or server?

like image 377
anish anil Avatar asked Jan 30 '18 09:01

anish anil


People also ask

How to access Kubernetes nodes from external IP?

Refer: forums.aws.amazon.com/thread.jspa?threadID=66813 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.

How do I remote SSH into my Kubernetes worker node?

You could now remote SSH into your Kubernetes worker node by clicking the terminal icon as shown in the screenshot below. Next, you'll will be prompted to provide your SSH login and password.

How to SSH into a K8 pod from outside the Kubernetes cluster?

Finally… How Do We SSH Into a K8 Pod From Outside the Kubernetes Cluster? Given that the Pod is accessible through the service and can be reached via the LoadBalancer service, serviced by a public load balancer; the user can SSH into the K8 Pod from outside the Kubernetes cluster by executing the classic ssh command as below:

How to connect to a Kubernetes pod from a local machine?

The easiest, and ofcourse, more secure way to connect to a Kubernetes Pod from your local linux machine or windows laptop or a macbook, is to install and run the SocketXP Remote SSH Agent Docker container as a standalone container pod in your Kubernetes cluster.


2 Answers

Try this: ssh -i <path of the private key file> admin@<ip of the aws kube instances>

The perm file should be in $HOME/.ssh/kube_rsa

like image 85
Swapnil Pandey Avatar answered Oct 02 '22 16:10

Swapnil Pandey


Use kubectl ssh node NODE_NAME

This kubectl addon is from here. https://github.com/luksa/kubectl-plugins. And I have verified that. This works similar to oc command in openshift.

like image 28
4t8dds Avatar answered Oct 02 '22 14:10

4t8dds