Skip to content

EKS node registration error

0

Hello Community,

I have recently launched a Kubernetes (K8s) master cluster hosted on an AWS EC2 instance running Ubuntu 22.04. I have also created multiple worker nodes that are intended to connect to this master cluster. However, I am encountering an issue where the worker nodes are unable to connect to the master cluster.

asked 2 years ago899 views
3 Answers
5
Accepted Answer

Hello,

FOR EKS:

Verify: Check master IP, port (6443),10250,443 and valid worker join token. Ensure network connectivity and open firewall ports.

Analyze Logs: Look for errors in master's kube-apiserver.log and worker's kubelet.log.

Create a IAM User in Your AWS Console.

  • Go to EKS Cluster
  • Select " Access " under EKS Cluster.
  • Add Your IAM User profile in the Cluster.

Enter image description here

After adding Your IAM User it will give connection to cluster and worker nodes Successfully.

FOR K8's:

1. Version Compatibility:

  • Check versions: Verify both master and worker nodes run compatible Kubernetes versions.

2. Install Required Tools on Worker Nodes:

  • Update package list: Use a command like sudo apt update (for Ubuntu/Debian) or sudo yum update (for RedHat/CentOS).
  • Install kubeadm, kubelet, and kubectl: Use a package manager like apt install kubeadm kubelet kubectl or yum install kubeadm kubelet kubectl.

3. Network Configuration:

  • Security groups: Allow traffic on ports 6443 (API server) and 10250 (kubelet) in security groups for all nodes.
  • VPC and subnets: Ensure all nodes are within the same VPC and subnets with allowed inter-node communication.

4. Join Worker Nodes to Cluster (on Master Node):

  • Generate join token: Run kubeadm token create to generate a new join token for worker nodes.
  • Join command for worker nodes: Provide the following on each worker node:
  • Master node IP address
  • Generated join token
  • Discovery token CA certificate hash (obtain from the master node)

Example join command (replace placeholders with actual values):

kubeadm join 192.168.1.100:6443 --token abcdefg123456 --discovery-token-ca-cert-hash sha256:...

5. Verify Worker Node Connection (on Master Node):

  • Check node status: Run kubectl get nodes to see if worker nodes appear as "Ready."

6. Troubleshooting Logs (if nodes don't join):

  • Worker node logs: Check kubelet logs for errors using journalctl -u kubelet -f.
  • Master node logs: Check API server logs using journalctl -u kube-apiserver -f for any issues.

Check the Document: Install and Set Up kubectl - Kubernetes (k8s-docs.netlify.app)

EXPERT
answered 2 years ago
EXPERT
reviewed 2 years ago
EXPERT
reviewed 2 years ago
EXPERT
reviewed 2 years ago
EXPERT
reviewed 2 years ago
4

**Check Logs: ** Examine logs on both the Master and worker nodes for any errors related to joining the cluster. Look for clues in the /var/log/kube-admin.log and /var/log/messages files.

Validate Network Connectivity: Use ping or a network diagnostic tool to confirm network connectivity between nodes.

**Review Join Command: **Verify the kubeadm join command used on worker nodes is correct, including the valid join token and the appropriate API server endpoint address.

**Check Configuration Files: **Ensure the configuration files used on both the Master and worker nodes (e.g., kubeadm-config.yaml) are consistent.

for more please follow the links https://kubernetes.io/docs/concepts/architecture/nodes/

https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-join/

EXPERT
answered 2 years ago
EXPERT
reviewed 2 years ago
EXPERT
reviewed 2 years ago
1

Hello,

Ensure that the versions of Kubernetes components used for both the master and worker nodes are the same.

1. Install Container Engine (Docker) Install Docker on both master and worker nodes:

sudo apt install docker.io -y
sudo chmod 666 /var/run/docker.sock

2. Install Dependencies for Kubernetes Install necessary dependencies on both master and worker nodes:

sudo apt-get install -y apt-transport-https ca-certificates curl gnupg
sudo mkdir -p -m 755 /etc/apt/keyrings

3. Install Kubernetes Components Install kubeadm, kubelet, and kubectl on both master and worker nodes:

sudo apt install -y kubeadm=1.28.1-1.1 kubelet=1.28.1-1.1 kubectl=1.28.1-1.1

4. Initialize the Master Node Run this command on the master node to initialize the Kubernetes cluster:

sudo kubeadm init

5. Set Up the Master Node To use kubectl as a regular user, run these commands as the user who will be administering the cluster (typically, your regular user account):

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

6. Retrieve the Join Command Run this command on the master node to retrieve the join command for worker nodes:

kubeadm token create --print-join-command

This command will output something like:

kubeadm join <master-node-ip>:6443 --token <token> --discovery-token-ca-cert-hash sha256:<hash>

7. Join the Worker Node SSH into each worker node and run the join command retrieved from the previous step:

sudo kubeadm join <master-node-ip>:6443 --token <token> --discovery-token-ca-cert-hash sha256:<hash>

On the master node, verify that the worker nodes have successfully joined by running "kubectl get nodes"

i hope this step resolve that issue if still you're facing any error give some details about it thank you

EXPERT
answered 2 years ago
EXPERT
reviewed 2 years ago
EXPERT
reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.