Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to SSH EKS Worker Nodes

I have create EKS cluster as specified in https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html

Added worker nodes as specified in above link Step 3: Launch and Configure Amazon EKS Worker Nodes

In security Group also I added rule for enabling ssh to worker nodes. When I tried to login to worker node with 'ec2-user' username and with valid key SSH Login is not happening.

Can anyone help me in debugging this issue ?

like image 455
Karthik Avatar asked Jan 28 '19 06:01

Karthik


People also ask

Can you ssh into EKS node?

You will need ssh access to one of the EC2 nodes running any of the EKS cluster nodes. The service to access will need to be either a NodePort service or a LoadBalancer service, so the service opens ports on all EC2 Kubernetes nodes. The port number is the same on all nodes.

How do I log into worker nodes in Kubernetes?

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 check my EKS nodes?

Select the Cluster group and then select the Nodes resource type. You see a list of all nodes in your cluster. The nodes can be any Amazon EKS node type. This is the same list that you see in the Nodes section when you select the Compute tab for your cluster.


2 Answers

I found a workaround. I created an EC2 instance with same VPC which is used by worker node, also used the same security group and Key Pair for newly created EC2 instance. I tried to login to newly created EC2 instance which works like charm ( don't know Why it won't work for worker nodes). Once I logged into the instance tried SSH to worker nodes from there with Private IP which is working as expected.

Again this a workaround. Not sure why I wasn't able to login to worker node.

like image 65
Karthik Avatar answered Sep 19 '22 12:09

Karthik


I think you are missing SSH rule for instance's security group or you are using the wrong SSH key to connect to the worker nodes.

Please check from the console your security group id, and add SSH rule from inbound rule like in the screenshot if you don't have it. SSH rule for security group of worker nodes

Or you can add same rule via aws cli like:

aws ec2 authorize-security-group-ingress --group-id <security-group-id>  --protocol tcp --port 22 --cidr 0.0.0.0/0

Then, by specifying a valid SSH key, you can run the below command to connect to your worker node.

ssh -i "ssh-key.pem" ec2-user@<node-external-ip or node-dns-name>

If you lost/miss your key, you need to create new stack in cloudformation with new SSH key-pair as described in the following tutorials.

Creating a Key Pair Using Amazon EC2 and Launch and Configure Amazon EKS Worker Nodes

I hope it will help you.

like image 35
coolinuxoid Avatar answered Sep 19 '22 12:09

coolinuxoid