Reputation: 131
Environmental Info: K3s Version: v1.23.8+k3s1 (53f2d4e7)
Node(s) CPU architecture: OS, and Version: Linux ip-172-31-88-240 5.15.0-1011-aws #14-Ubuntu SMP Wed Jun 1 20:54:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Cluster Configuration: 1 master and 2 agent nodes
Description the bug: Agent node not joining master node when I type command kubectl get nodes.
Steps To Reproduce:
Installed K3s on the master node
MASTER_IP=3.93.220.207 (IPv4 Public IP: 3.93.220.207)
$curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--write-kubeconfig-mode 644 --no-deploy traefik --disable traefik --tls-san "$MASTER_IP" --node-external-ip "$MASTER_IP" --disable servicelb" sh -s -
Generated token by sudo cat /var/lib/rancher/k3s/server/node-token
On each agent
MASTER_IP=3.93.220.207
export TOKEN=YOUR_MASTER_TOKEN
curl -sfL https://get.k3s.io | sh -s - agent --server https://$MASTER_IP :6443 --token ${TOKEN}
Expected behavior:
kubectl get nodes
command should show agent nodes, but agent nodes are not attached ...
Actual behavior: kubectl get nodes does not show agent nodes ....
Please help me to resolve this issue ..... I have done all steps correctly and also exposed the public IP ....I am feeling frustated ... I have been trying this from many days.I even tried implementing this on a virtual box as well but every time I get disappointment.
EXTRA INFORMATION (failed to get CA CERTS)
systemctl status k3s-agent
command gives shows
Upvotes: 2
Views: 3544
Reputation: 794
From your master node setup command, since you did not supply K3S_TOKEN
so the token is generated, so make sure your YOUR_MASTER_TOKEN
value is correct, it can be retrieved by running sudo cat /var/lib/rancher/k3s/server/token
in the master node.
The command you run in K3S agent doesn't look right, it is seems that you are mixing the command of joining cluster as agent
and as master
, make sure you know the difference between a HA cluster and non-HA cluster.
To add K3s agent to the cluster, just run
export URL="https://<<Master IP address>>:6443"
export TOKEN="<<TOKEN>>"
curl -sfL https://get.k3s.io | K3S_URL=$URL K3S_TOKEN=$TOKEN sh -
Finally, as you are running it in AWS, make sure your VPC
settings correct, it includes the right Security Group
settings to allow communication to/from IP range
and Port range
between your master
and agent
node. Also, the NACL
of your subnets.
If you are doing it for POC purpose, just put all the instance in the same public subnet
will save your time.
Upvotes: 1