1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/update-creating-mcp-groups-for-the-cluster.adoc
Cavalle 64e845d54d TELCODOCS-2171-lifecycle-mgmt-lcavalle: Generalize Day2Ops Lifecycle management
TELCODOCS-2171-lifecycle-mgmt-lcavalle: fixing some vale errors
2026-01-13 16:57:30 +00:00

133 lines
4.3 KiB
Plaintext

// Module included in the following assemblies:
//
// * edge_computing/day_2_core_cnf_clusters/updating/update-ocp-update-prep.adoc
:_mod-docs-content-type: PROCEDURE
[id="update-creating-mcp-groups-for-the-cluster_{context}"]
= Creating MachineConfigPool groups for the cluster
[role="_abstract"]
Creating `mcp` groups is a 2-step process:
. Add an `mcp` label to the nodes in the cluster
. Apply an `mcp` CR to the cluster that organizes the nodes based on their labels
.Procedure
. Label the nodes so that they can be put into `mcp` groups.
Run the following commands:
+
[source,terminal]
----
$ oc label node worker-0 node-role.kubernetes.io/mcp-1=
----
+
[source,terminal]
----
$ oc label node worker-1 node-role.kubernetes.io/mcp-2=
----
+
The `mcp-1` and `mcp-2` labels are applied to the nodes.
For example:
+
.Example output
[source,terminal]
----
NAME STATUS ROLES AGE VERSION
ctrl-plane-0 Ready control-plane,master 39d v1.27.15+6147456
ctrl-plane-1 Ready control-plane,master 39d v1.27.15+6147456
ctrl-plane-2 Ready control-plane,master 39d v1.27.15+6147456
worker-0 Ready mcp-1,worker 39d v1.27.15+6147456
worker-1 Ready mcp-2,worker 39d v1.27.15+6147456
----
. Create YAML custom resources (CRs) that apply the labels as `mcp` CRs in the cluster.
Save the following YAML in the `mcps.yaml` file:
+
[source,yaml]
----
---
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
metadata:
name: mcp-2
spec:
machineConfigSelector:
matchExpressions:
- {
key: machineconfiguration.openshift.io/role,
operator: In,
values: [worker,mcp-2]
}
nodeSelector:
matchLabels:
node-role.kubernetes.io/mcp-2: ""
---
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
metadata:
name: mcp-1
spec:
machineConfigSelector:
matchExpressions:
- {
key: machineconfiguration.openshift.io/role,
operator: In,
values: [worker,mcp-1]
}
nodeSelector:
matchLabels:
node-role.kubernetes.io/mcp-1: ""
----
. Create the `MachineConfigPool` resources:
+
[source,terminal]
----
$ oc apply -f mcps.yaml
----
+
.Example output
[source,terminal]
----
machineconfigpool.machineconfiguration.openshift.io/mcp-2 created
----
.Verification
Monitor the `MachineConfigPool` resources as they are applied in the cluster.
After you apply the `mcp` resources, the nodes are added into the new machine config pools.
This takes a few minutes.
[NOTE]
====
The nodes do not reboot while being added into the `mcp` groups.
The original worker and master `mcp` groups remain unchanged.
====
* Check the status of the new `mcp` resources:
+
[source,terminal]
----
$ oc get mcp
----
+
.Example output
[source,terminal]
----
NAME CONFIG UPDATED UPDATING DEGRADED MACHINECOUNT READYMACHINECOUNT UPDATEDMACHINECOUNT DEGRADEDMACHINECOUNT AGE
master rendered-master-be3e83 True False False 3 3 3 0 25d
mcp-1 rendered-mcp-1-2f4c4f False True True 1 0 0 0 10s
mcp-2 rendered-mcp-2-2r4s1f False True True 1 0 0 0 10s
worker rendered-worker-23fc4f False True True 0 0 0 2 25d
----
+
Eventually, the resources are fully applied:
+
[source,terminal]
----
NAME CONFIG UPDATED UPDATING DEGRADED MACHINECOUNT READYMACHINECOUNT UPDATEDMACHINECOUNT DEGRADEDMACHINECOUNT AGE
master rendered-master-be3e83 True False False 3 3 3 0 25d
mcp-1 rendered-mcp-1-2f4c4f True False False 1 1 1 0 7m33s
mcp-2 rendered-mcp-2-2r4s1f True False False 1 1 1 0 51s
worker rendered-worker-23fc4f True False False 0 0 0 0 25d
----