1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-07 09:46:53 +01:00
Files
openshift-docs/modules/machineset-creating.adoc

269 lines
10 KiB
Plaintext

// Module included in the following assemblies:
//
// * machine_management/creating-infrastructure-machinesets.adoc
// * machine_management/creating_machinesets/creating-machineset-aws.adoc
// * machine_management/creating_machinesets/creating-machineset-azure.adoc
// * machine_management/creating_machinesets/creating-machineset-azure-stack-hub.adoc
// * machine_management/creating_machinesets/creating-machineset-gcp.adoc
// * machine_management/creating_machinesets/creating-machineset-osp.adoc
// * machine_management/creating_machinesets/creating-machineset-vsphere.adoc
// * windows_containers/creating_windows_machinesets/creating-windows-machineset-aws.adoc
// * windows_containers/creating_windows_machinesets/creating-windows-machineset-azure.adoc
// * windows_containers/creating_windows_machinesets/creating-windows-machineset-vsphere.adoc
// * windows_containers/creating_windows_machinesets/creating-windows-machineset-gcp.adoc
// * post_installation_configuration/cluster-tasks.adoc
// * post_installation_configuration/aws-compute-edge-zone-tasks.adoc
// * windows_containers/creating_windows_machinesets/creating-windows-machineset-nutanix.adoc
ifeval::["{context}" == "creating-windows-machineset-aws"]
:win:
endif::[]
ifeval::["{context}" == "creating-windows-machineset-azure"]
:win:
endif::[]
ifeval::["{context}" == "creating-machineset-azure-stack-hub"]
:ash:
endif::[]
ifeval::["{context}" == "creating-windows-machineset-vsphere"]
:win:
endif::[]
ifeval::["{context}" == "creating-machineset-vsphere"]
:vsphere:
endif::[]
ifeval::["{context}" == "aws-compute-edge-zone-tasks"]
:post-aws-zones:
endif::[]
:_mod-docs-content-type: PROCEDURE
[id="machineset-creating_{context}"]
= Creating a compute machine set
In addition to the compute machine sets created by the installation program, you can create your own to dynamically manage the machine compute resources for specific workloads of your choice.
ifdef::vsphere[]
[NOTE]
====
Clusters that are installed with user-provisioned infrastructure have a different networking stack than clusters with infrastructure that is provisioned by the installation program. As a result of this difference, automatic load balancer management is unsupported on clusters that have user-provisioned infrastructure. For these clusters, a compute machine set can only create `worker` and `infra` type machines.
====
endif::vsphere[]
.Prerequisites
* Deploy an {product-title} cluster.
* Install the OpenShift CLI (`oc`).
* Log in to `oc` as a user with `cluster-admin` permission.
ifdef::vsphere[]
* Have the necessary permissions to deploy VMs in your vCenter instance and have the required access to the datastore specified.
* If your cluster uses user-provisioned infrastructure, you have satisfied the specific Machine API requirements for that configuration.
endif::vsphere[]
ifdef::ash[]
* Create an availability set in which to deploy Azure Stack Hub compute machines.
endif::ash[]
.Procedure
. Create a new YAML file that contains the compute machine set custom resource (CR) sample and is named `<file_name>.yaml`.
+
ifndef::ash[]
Ensure that you set the `<clusterID>` and `<role>` parameter values.
endif::ash[]
ifdef::ash[]
Ensure that you set the `<availabilitySet>`, `<clusterID>`, and `<role>` parameter values.
endif::ash[]
. Optional: If you are not sure which value to set for a specific field, you can check an existing compute machine set from your cluster.
.. To list the compute machine sets in your cluster, run the following command:
+
[source,terminal]
----
$ oc get machinesets -n openshift-machine-api
----
+
.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 view values of a specific compute machine set custom resource (CR), run the following command:
+
[source,terminal]
----
$ oc get machineset <machineset_name> \
-n openshift-machine-api -o yaml
----
+
--
.Example output
[source,yaml]
----
apiVersion: machine.openshift.io/v1beta1
kind: MachineSet
metadata:
labels:
machine.openshift.io/cluster-api-cluster: <infrastructure_id> <1>
name: <infrastructure_id>-<role> <2>
namespace: openshift-machine-api
spec:
replicas: 1
selector:
matchLabels:
machine.openshift.io/cluster-api-cluster: <infrastructure_id>
machine.openshift.io/cluster-api-machineset: <infrastructure_id>-<role>
template:
metadata:
labels:
machine.openshift.io/cluster-api-cluster: <infrastructure_id>
machine.openshift.io/cluster-api-machine-role: <role>
machine.openshift.io/cluster-api-machine-type: <role>
machine.openshift.io/cluster-api-machineset: <infrastructure_id>-<role>
spec:
providerSpec: <3>
...
----
<1> The cluster infrastructure ID.
<2> A default node label.
+
[NOTE]
====
For clusters that have user-provisioned infrastructure, a compute machine set can only create `worker` and `infra` type machines.
====
<3> The values in the `<providerSpec>` section of the compute machine set CR are platform-specific. For more information about `<providerSpec>` parameters in the CR, see the sample compute machine set CR configuration for your provider.
--
ifdef::vsphere[]
.. If you are creating a compute machine set for a cluster that has user-provisioned infrastructure, note the following important values:
+
.Example vSphere `providerSpec` values
[source,yaml]
----
apiVersion: machine.openshift.io/v1beta1
kind: MachineSet
...
template:
...
spec:
providerSpec:
value:
apiVersion: machine.openshift.io/v1beta1
credentialsSecret:
name: vsphere-cloud-credentials <1>
diskGiB: 120
kind: VSphereMachineProviderSpec
memoryMiB: 16384
network:
devices:
- networkName: "<vm_network_name>"
numCPUs: 4
numCoresPerSocket: 4
snapshot: ""
template: <vm_template_name> <2>
userDataSecret:
name: worker-user-data <3>
workspace:
datacenter: <vcenter_datacenter_name>
datastore: <vcenter_datastore_name>
folder: <vcenter_vm_folder_path>
resourcepool: <vsphere_resource_pool>
server: <vcenter_server_address> <4>
----
<1> The name of the secret in the `openshift-machine-api` namespace that contains the required vCenter credentials.
<2> The name of the {op-system} VM template for your cluster that was created during installation.
<3> The name of the secret in the `openshift-machine-api` namespace that contains the required Ignition configuration credentials.
<4> The IP address or fully qualified domain name (FQDN) of the vCenter server.
endif::vsphere[]
. Create a `MachineSet` CR by running the following command:
+
[source,terminal]
----
$ oc create -f <file_name>.yaml
----
ifeval::["{context}" == "creating-machineset-aws"]
. If you need compute machine sets in other availability zones, repeat this process to create more compute machine sets.
endif::[]
.Verification
* View the list of compute machine sets by running the following command:
+
[source,terminal]
----
$ oc get machineset -n openshift-machine-api
----
+
.Example output
[source,terminal]
----
ifdef::win,post-aws-zones[]
NAME DESIRED CURRENT READY AVAILABLE AGE
ifdef::win[]
agl030519-vplxk-windows-worker-us-east-1a 1 1 1 1 11m
endif::win[]
ifdef::post-aws-zones[]
agl030519-vplxk-edge-us-east-1-nyc-1a 1 1 1 1 11m
endif::post-aws-zones[]
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
endif::win,post-aws-zones[]
ifndef::win,post-aws-zones[]
NAME DESIRED CURRENT READY AVAILABLE AGE
agl030519-vplxk-infra-us-east-1a 1 1 1 1 11m
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
endif::win,post-aws-zones[]
----
+
When the new compute machine set is available, the `DESIRED` and `CURRENT` values match. If the compute machine set is not available, wait a few minutes and run the command again.
ifdef::post-aws-zones[]
* Optional: To check nodes that were created by the edge machine, run the following command:
+
[source,terminal]
----
$ oc get nodes -l node-role.kubernetes.io/edge
----
+
.Example output
[source,terminal]
----
NAME STATUS ROLES AGE VERSION
ip-10-0-207-188.ec2.internal Ready edge,worker 172m v1.25.2+d2e245f
----
endif::post-aws-zones[]
ifeval::["{context}" == "creating-machineset-vsphere"]
:!vsphere:
endif::[]
ifeval::["{context}" == "creating-windows-machineset-aws"]
:!win:
endif::[]
ifeval::["{context}" == "creating-machineset-azure-stack-hub"]
:!ash:
endif::[]
ifeval::["{context}" == "creating-windows-machineset-azure"]
:!win:
endif::[]
ifeval::["{context}" == "creating-windows-machineset-vsphere"]
:!win:
endif::[]
ifeval::["{context}" == "aws-compute-edge-zone-tasks"]
:!post-aws-zones:
endif::[]