New nodes can be added to a cluster by appending their specification to the
setup/machines.yaml file, which is generated in the cluster directory upon cluster creation.
The file is a YAML list of Machine items as defined in Cluster-API v1alpha3.
Adding a new node, which has been setup with the same SSH user and key that was used to create the cluster, comes down to:
- copying another Machine item and setting its name
- ensure the 'cluster.x-k8s.io/cluster-name' label is included when you copy and paste the Machine/ExistingInfraMachine set
- setting its role to
- setting its private and public IP addresses.
Machine item for reference:
Once the machine(s) have been added to the
machines.yaml, commit and push the changes to the remote repo.
wks-controller pod in the
weavek8sops namespace, will start the process of adding the new node to the cluster.
Progress of the operation can be monitored from its logs.
Similar to the process of adding a node to the cluster, just delete the
ExistingInfraMachine pair corresponding to the node
from the list in
setup/machines.yaml, and then commit and push to the remote repo.
wks-controller will notice that the machine has been removed and then drain the workload(s) from the node and ultimately remove the node from the cluster.