mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-07 09:46:53 +01:00
207 lines
5.7 KiB
Plaintext
207 lines
5.7 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * machine_management/capi-machine-management.adoc
|
|
|
|
:_mod-docs-content-type: PROCEDURE
|
|
[id="capi-machine-set-creating_{context}"]
|
|
= Creating a Cluster API compute machine set
|
|
|
|
You can create compute machine sets that use the Cluster API to dynamically manage the machine compute resources for specific workloads of your choice.
|
|
|
|
.Prerequisites
|
|
|
|
* Deploy an {product-title} cluster.
|
|
* Enable the use of the Cluster API.
|
|
* Install the OpenShift CLI (`oc`).
|
|
* Log in to `oc` as a user with `cluster-admin` permission.
|
|
|
|
.Procedure
|
|
|
|
. Create a YAML file that contains the cluster custom resource (CR) and is named `<cluster_resource_file>.yaml`.
|
|
+
|
|
If you are not sure which value to set for the `<cluster_name>` parameter, you can check the value for an existing Machine API compute machine set in your cluster.
|
|
|
|
.. To list the Machine API compute machine sets, run the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc get machinesets -n openshift-machine-api <1>
|
|
----
|
|
<1> Specify the `openshift-machine-api` namespace.
|
|
+
|
|
.Example output
|
|
[source,terminal]
|
|
----
|
|
NAME DESIRED CURRENT READY AVAILABLE AGE
|
|
agl030519-vplxk-worker-us-east-1a 1 1 1 1 55m
|
|
agl030519-vplxk-worker-us-east-1b 1 1 1 1 55m
|
|
agl030519-vplxk-worker-us-east-1c 1 1 1 1 55m
|
|
agl030519-vplxk-worker-us-east-1d 0 0 55m
|
|
agl030519-vplxk-worker-us-east-1e 0 0 55m
|
|
agl030519-vplxk-worker-us-east-1f 0 0 55m
|
|
----
|
|
|
|
.. To display the contents of a specific compute machine set CR, run the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc get machineset <machineset_name> \
|
|
-n openshift-machine-api \
|
|
-o yaml
|
|
----
|
|
+
|
|
.Example output
|
|
[source,yaml]
|
|
----
|
|
...
|
|
template:
|
|
metadata:
|
|
labels:
|
|
machine.openshift.io/cluster-api-cluster: agl030519-vplxk <1>
|
|
machine.openshift.io/cluster-api-machine-role: worker
|
|
machine.openshift.io/cluster-api-machine-type: worker
|
|
machine.openshift.io/cluster-api-machineset: agl030519-vplxk-worker-us-east-1a
|
|
...
|
|
----
|
|
<1> The cluster ID, which you use for the `<cluster_name>` parameter.
|
|
|
|
. Create the cluster CR by running the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc create -f <cluster_resource_file>.yaml
|
|
----
|
|
+
|
|
.Verification
|
|
+
|
|
To confirm that the cluster CR is created, run the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc get cluster
|
|
----
|
|
+
|
|
.Example output
|
|
[source,terminal]
|
|
----
|
|
NAME PHASE AGE VERSION
|
|
<cluster_name> Provisioning 4h6m
|
|
----
|
|
|
|
. Create a YAML file that contains the infrastructure CR and is named `<infrastructure_resource_file>.yaml`.
|
|
|
|
. Create the infrastructure CR by running the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc create -f <infrastructure_resource_file>.yaml
|
|
----
|
|
+
|
|
.Verification
|
|
+
|
|
To confirm that the infrastructure CR is created, run the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc get <infrastructure_kind>
|
|
----
|
|
+
|
|
where `<infrastructure_kind>` is the value that corresponds to your platform.
|
|
+
|
|
.Example output
|
|
[source,terminal]
|
|
----
|
|
NAME CLUSTER READY VPC BASTION IP
|
|
<cluster_name> <cluster_name> true
|
|
----
|
|
|
|
. Create a YAML file that contains the machine template CR and is named `<machine_template_resource_file>.yaml`.
|
|
|
|
. Create the machine template CR by running the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc create -f <machine_template_resource_file>.yaml
|
|
----
|
|
+
|
|
.Verification
|
|
+
|
|
To confirm that the machine template CR is created, run the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc get <machine_template_kind>
|
|
----
|
|
+
|
|
where `<machine_template_kind>` is the value that corresponds to your platform.
|
|
+
|
|
.Example output
|
|
[source,terminal]
|
|
----
|
|
NAME AGE
|
|
<template_name> 77m
|
|
----
|
|
|
|
. Create a YAML file that contains the compute machine set CR and is named `<machine_set_resource_file>.yaml`.
|
|
|
|
. Create the compute machine set CR by running the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc create -f <machine_set_resource_file>.yaml
|
|
----
|
|
+
|
|
.Verification
|
|
+
|
|
To confirm that the compute machine set CR is created, run the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc get machineset -n openshift-cluster-api <1>
|
|
----
|
|
<1> Specify the `openshift-cluster-api` namespace.
|
|
+
|
|
.Example output
|
|
[source,terminal]
|
|
----
|
|
NAME CLUSTER REPLICAS READY AVAILABLE AGE VERSION
|
|
<machine_set_name> <cluster_name> 1 1 1 17m
|
|
----
|
|
+
|
|
When the new compute machine set is available, the `REPLICAS` and `AVAILABLE` values match. If the compute machine set is not available, wait a few minutes and run the command again.
|
|
|
|
.Verification
|
|
|
|
* To verify that the compute machine set is creating machines according to your required configuration, review the lists of machines and nodes in the cluster by using the following steps:
|
|
|
|
** To view the list of Cluster API machines, run the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc get machine -n openshift-cluster-api <1>
|
|
----
|
|
<1> Specify the `openshift-cluster-api` namespace.
|
|
+
|
|
.Example output
|
|
[source,terminal]
|
|
----
|
|
NAME CLUSTER NODENAME PROVIDERID PHASE AGE VERSION
|
|
<machine_set_name>-<string_id> <cluster_name> <ip_address>.<region>.compute.internal <provider_id> Running 8m23s
|
|
----
|
|
|
|
** To view the list of nodes, run the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc get node
|
|
----
|
|
+
|
|
.Example output
|
|
[source,terminal]
|
|
----
|
|
NAME STATUS ROLES AGE VERSION
|
|
<ip_address_1>.<region>.compute.internal Ready worker 5h14m v1.28.5
|
|
<ip_address_2>.<region>.compute.internal Ready master 5h19m v1.28.5
|
|
<ip_address_3>.<region>.compute.internal Ready worker 7m v1.28.5
|
|
----
|