Kubernetes - Worker nodes
Leon Nunes
Posted on April 11, 2022
Kubernetes is a container Orchestrator, the main key point of Kubernetes is it packs a lot of things like scheduling, fail-over, high availability all in one tool.
But how does Kubernetes provide all this, well the way it does it is by Clustering multiple servers called as nodes. So basically imagine Kubernetes is a Octopus(But this octopus can start adding tentacles when needed). The nodes are like bee's and Kubernetes is the hive leader.
When you run your containers, the kubernetes scheduler will schedule the pods on the respective node, depending on how many containers are running on those nodes and the amount of space etc it's smart.
So how do I add nodes?
Well the token needs to be added on the nodes, for example K3s uses This
For microk8s use, official docs
microk8s add-node
This will return some joining instructions which should be executed on the MicroK8s instance that you wish to join to the cluster (NOT THE NODE YOU RAN add-node FROM)
From the node you wish to join to this cluster, run the following:
microk8s join 192.168.1.230:25000/92b2db237428470dc4fcfc4ebbd9dc81/2c0cb3284b05
Use the '--worker' flag to join a node as a worker not running the control plane, eg:
microk8s join 192.168.1.230:25000/92b2db237428470dc4fcfc4ebbd9dc81/2c0cb3284b05 --worker
If the node you are adding is not reachable through the default interface you can use one of the following:
microk8s join 192.168.1.230:25000/92b2db237428470dc4fcfc4ebbd9dc81/2c0cb3284b05
microk8s join 10.23.209.1:25000/92b2db237428470dc4fcfc4ebbd9dc81/2c0cb3284b05
microk8s join 172.17.0.1:25000/92b2db237428470dc4fcfc4ebbd9dc81/2c0cb3284b05
For kind, Official Docs
To configure kind cluster creation, you will need to create a YAML config file. This file follows Kubernetes conventions for versioning etc.
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
# One control plane node and three "workers".
#
# While these will not add more real compute capacity and
# have limited isolation, this can be useful for testing
# rolling updates etc.
#
# The API-server and other control plane components will be
# on the control-plane node.
#
# You probably don't need this unless you are testing Kubernetes itself.
nodes:
- role: control-plane
- role: worker
- role: worker
- role: worker
To add a node using kubeadm
kubeadm token create --print-join-command
kubeadm join 192.168.0.150:6443 --token 1642s5.ih5q6mdtf0pt9jey --discovery-token-ca-cet-hash sha256:d35bc841bd1ad7fd0223e506c8484bcafe9aa59427535b2709ed4b41201ce81b
Refer: This
That's all, any feedback or criticism is highly appreciated.
You can reach out to me at @mediocreDevops for any discussions or freelance opportunities.
Posted on April 11, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.