1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/cpmso-creating-cr.adoc

87 lines
3.9 KiB
Plaintext

// Module included in the following assemblies:
//
// * machine_management/cpmso-getting-started.adoc
:_mod-docs-content-type: PROCEDURE
[id="cpmso-creating-cr_{context}"]
= Creating a control plane machine set custom resource
To use the control plane machine set, you must ensure that a `ControlPlaneMachineSet` custom resource (CR) with the correct settings for your cluster exists. On a cluster without a generated CR, you must create the CR manually and activate it.
[NOTE]
====
For more information about the structure and parameters of the CR, see "Control plane machine set configuration".
====
.Procedure
. Create a YAML file using the following template:
+
--
.Control plane machine set CR YAML file template
[source,yaml]
----
apiVersion: machine.openshift.io/v1
kind: ControlPlaneMachineSet
metadata:
name: cluster
namespace: openshift-machine-api
spec:
replicas: 3
selector:
matchLabels:
machine.openshift.io/cluster-api-cluster: <cluster_id> <1>
machine.openshift.io/cluster-api-machine-role: master
machine.openshift.io/cluster-api-machine-type: master
state: Active <2>
strategy:
type: RollingUpdate <3>
template:
machineType: machines_v1beta1_machine_openshift_io
machines_v1beta1_machine_openshift_io:
failureDomains:
platform: <platform> <4>
<platform_failure_domains> <5>
metadata:
labels:
machine.openshift.io/cluster-api-cluster: <cluster_id> <6>
machine.openshift.io/cluster-api-machine-role: master
machine.openshift.io/cluster-api-machine-type: master
spec:
providerSpec:
value:
<platform_provider_spec> <7>
----
<1> Specify the infrastructure ID that is based on the cluster ID that you set when you provisioned the cluster. You must specify this value when you create a `ControlPlaneMachineSet` CR. If you have the OpenShift CLI (`oc`) installed, you can obtain the infrastructure ID by running the following command:
+
[source,terminal]
----
$ oc get -o jsonpath='{.status.infrastructureName}{"\n"}' infrastructure cluster
----
<2> Specify the state of the Operator. When the state is `Inactive`, the Operator is not operational. You can activate the Operator by setting the value to `Active`.
+
[IMPORTANT]
====
Before you activate the CR, you must ensure that its configuration is correct for your cluster requirements.
====
<3> Specify the update strategy for the cluster. Valid values are `OnDelete` and `RollingUpdate`. The default value is `RollingUpdate`. For more information about update strategies, see "Updating the control plane configuration".
<4> Specify your cloud provider platform name. Valid values are `AWS`, `Azure`, `GCP`, `Nutanix`, `VSphere`, and `OpenStack`.
<5> Add the `<platform_failure_domains>` configuration for the cluster. The format and values of this section are provider-specific. For more information, see the sample failure domain configuration for your cloud provider.
<6> Specify the infrastructure ID.
<7> Add the `<platform_provider_spec>` configuration for the cluster. The format and values of this section are provider-specific. For more information, see the sample provider specification for your cloud provider.
--
. Refer to the sample YAML for a control plane machine set CR and populate your file with values that are appropriate for your cluster configuration.
. Refer to the sample failure domain configuration and sample provider specification for your cloud provider and update those sections of your file with the appropriate values.
. When the configuration is correct, activate the CR by setting the `.spec.state` field to `Active` and saving your changes.
. Create the CR from your YAML file by running the following command:
+
[source,terminal]
----
$ oc create -f <control_plane_machine_set>.yaml
----
+
where `<control_plane_machine_set>` is the name of the YAML file that contains the CR configuration.