In my previous blogs, I have been focused on the master and its components (etcd, in particular).
Now, with OpenShift 4.x, the installer can create the masters and workers. It’s pretty cool.
So, what happens when we delete a worker?
I have a typical OpenShift 4.1 environment, with the following machines:
patro:scripts edu$ oc get machines -n openshift-machine-api -o name
So, 3 masters and 3 workers.
Deleting a worker
Let’s know delete a worker node. There are many ways to do so, and I am going to use the Kubernetes CLI and the concept of Machine to do a VM:
patro:scripts edu$ oc delete machine cluster-c940-62wnw-worker-us-east-2a-tppgv -n openshift-machine-api
machine.machine.openshift.io "cluster-c940-62wnw-worker-us-east-2a-tppgv" deleted
Now, if we look at the number of machines, we would expect 5, right?
Let’s see the machines:
patro:scripts edu$ oc get machines -n openshift-machine-api
NAME INSTANCE STATE TYPE REGION ZONE AGE
cluster-c940-62wnw-master-0 i-0f4e8e08ab0d3c719 running m5.xlarge us-east-2 us-east-2b 2d23h
cluster-c940-62wnw-master-1 i-0da093bcbc5cacb15 running m5.xlarge us-east-2 us-east-2b 3d12h
cluster-c940-62wnw-master-2 i-03544f4a7dfcc4dff running m5.xlarge us-east-2 us-east-2c 3d12h
cluster-c940-62wnw-worker-us-east-2a-4ff5g i-015178130556a4618 running m5.2xlarge us-east-2 us-east-2a 82s
cluster-c940-62wnw-worker-us-east-2b-gxxm5 i-0a1a1f2b262c564b9 running m5.2xlarge us-east-2 us-east-2b 3d11h
cluster-c940-62wnw-worker-us-east-2c-wfkmh i-0922eb87495aa8dfa running m5.2xlarge us-east-2 us-east-2c 3d11h
You see that OpenShift immediately created another machine, in the same availability zone.
That’s the power of Machines and MachineSets.
What are MachineSets
In the same way a ReplicaSet provides resilience to a Pod, a MachineSet provide resilience for a Machine.
Using the Kubernetes principle of desired state, a MachineSet will declare how many Machines in a certain availability zone we want.
So, let’s look at the MachineSets:
patro:scripts edu$ oc get machinesets -n openshift-machine-api
NAME DESIRED CURRENT READY AVAILABLE AGE
cluster-c940-62wnw-worker-us-east-2a 1 1 3d12h
cluster-c940-62wnw-worker-us-east-2b 1 1 1 1 3d12h
cluster-c940-62wnw-worker-us-east-2c 1 1 1 1 3d12h
So, we can see, we are declaring that we want 1 Machine in us-east-2a. So, as soon as we destroy the corresponding Machine, the MachineSet Operator will quickly deploy another VM in AWS and configure as a worker.
In this blog, I explained how MachineSets provide resilience to the workers in OpenShift.
Bring your plan to the IBM Garage.
Are you ready to learn more about working with the IBM Garage? We’re here to help. Contact us today to schedule time to speak with a Garage expert about your next big idea. Learn about our IBM Garage Method, the design, development and startup communities we work in, and the deep expertise and capabilities we bring to the table.
Schedule a no-charge visit with the IBM Garage.