Replace Cluster Nodes

Replace cluster nodes

This section describes how to replace cluster nodes in your cluster.

Direct replacement of nodes is not possible in KubeOps; however you can delete the node and add a new node to the cluster as shown in the following example.

Steps to replace a Kubernetes Node

  1. Use the command delete on the admin node to delete the unwanted node from the cluster.

    The command is:

    lima delete -n <IP of your node> <name of your Cluster>
    
    If you are deleting a node, then its data becomes inaccessible or erased.
  2. Now create a new .yaml file with a configuration for the node as shown below

    Example:

    apiVersion: lima/nodeconfig/v1alpha1
    clusterName: roottest
    spec:
      masters: []
      workers:
      - host: 10.2.10.17  ## ip of the new node to be joined
        user: root
        password: toor
    
  3. Lastly use the command create nodes to create and join the new node.

    The command is:

    lima create nodes -f <node yaml file name>
    

Example 1

In the following example, we will replace a node with ip 10.2.10.15 from demoCluster to a new worker node with ip 10.2.10.17:

  1. Delete node.

    lima delete -n 10.2.10.15 demoCluster
    
  2. create addNode.yaml for new worker node.

    apiVersion: lima/nodeconfig/v1alpha1
    clusterName: roottest
    spec:
      masters: []
      workers:
      - host: 10.2.10.17
        user: root
        password: toor
    
  3. Join the new node.

    lima create nodes -f addNode.yaml
    

Example 2

If you are rejoining a master node, all other steps are the same except, you need to add the node configuration in the yaml file as shown in the example below:

apiVersion: lima/nodeconfig/v1alpha1
clusterName: roottest
spec:
  masters:
  - host: 10.2.10.17
    user: root
    password: toor
  workers: []