|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * machine_management/creating-infrastructure-machinesets.adoc |
| 4 | +// * machine_management/creating_machinesets/creating-machineset-azure-stack-hub.adoc |
| 5 | +// * post_installation_configuration/cluster-tasks.adoc |
| 6 | + |
| 7 | +ifeval::["{context}" == "creating-infrastructure-machinesets"] |
| 8 | +:infra: |
| 9 | +endif::[] |
| 10 | +ifeval::["{context}" == "post-install-cluster-tasks"] |
| 11 | +:infra: |
| 12 | +endif::[] |
| 13 | + |
| 14 | +[id="machineset-yaml-azure-stack-hub_{context}"] |
| 15 | += Sample YAML for a machine set custom resource on Azure Stack Hub |
| 16 | + |
| 17 | +This sample YAML defines a machine set that runs in the `1` Microsoft Azure zone in a region and creates nodes that are labeled with |
| 18 | +ifndef::infra[`node-role.kubernetes.io/<role>: ""`.] |
| 19 | +ifdef::infra[`node-role.kubernetes.io/infra: ""`.] |
| 20 | + |
| 21 | +In this sample, `<infrastructure_id>` is the infrastructure ID label that is based on the cluster ID that you set when you provisioned the cluster, and |
| 22 | +ifndef::infra[`<role>`] |
| 23 | +ifdef::infra[`<infra>`] |
| 24 | +is the node label to add. |
| 25 | + |
| 26 | +[source,yaml] |
| 27 | +---- |
| 28 | +apiVersion: machine.openshift.io/v1beta1 |
| 29 | +kind: MachineSet |
| 30 | +metadata: |
| 31 | + labels: |
| 32 | + machine.openshift.io/cluster-api-cluster: <infrastructure_id> <1> |
| 33 | +ifndef::infra[] |
| 34 | + machine.openshift.io/cluster-api-machine-role: <role> <2> |
| 35 | + machine.openshift.io/cluster-api-machine-type: <role> <2> |
| 36 | + name: <infrastructure_id>-<role>-<region> <3> |
| 37 | +endif::infra[] |
| 38 | +ifdef::infra[] |
| 39 | + machine.openshift.io/cluster-api-machine-role: <infra> <2> |
| 40 | + machine.openshift.io/cluster-api-machine-type: <infra> <2> |
| 41 | + name: <infrastructure_id>-infra-<region> <3> |
| 42 | +endif::infra[] |
| 43 | + namespace: openshift-machine-api |
| 44 | +spec: |
| 45 | + replicas: 1 |
| 46 | + selector: |
| 47 | + matchLabels: |
| 48 | + machine.openshift.io/cluster-api-cluster: <infrastructure_id> <1> |
| 49 | +ifndef::infra[] |
| 50 | + machine.openshift.io/cluster-api-machineset: <infrastructure_id>-<role>-<region> <3> |
| 51 | +endif::infra[] |
| 52 | +ifdef::infra[] |
| 53 | + machine.openshift.io/cluster-api-machineset: <infrastructure_id>-infra-<region> <3> |
| 54 | +endif::infra[] |
| 55 | + template: |
| 56 | + metadata: |
| 57 | + creationTimestamp: null |
| 58 | + labels: |
| 59 | + machine.openshift.io/cluster-api-cluster: <infrastructure_id> <1> |
| 60 | +ifndef::infra[] |
| 61 | + machine.openshift.io/cluster-api-machine-role: <role> <2> |
| 62 | + machine.openshift.io/cluster-api-machine-type: <role> <2> |
| 63 | + machine.openshift.io/cluster-api-machineset: <infrastructure_id>-<role>-<region> <3> |
| 64 | +endif::infra[] |
| 65 | +ifdef::infra[] |
| 66 | + machine.openshift.io/cluster-api-machine-role: <infra> <2> |
| 67 | + machine.openshift.io/cluster-api-machine-type: <infra> <2> |
| 68 | + machine.openshift.io/cluster-api-machineset: <infrastructure_id>-infra-<region> <3> |
| 69 | +endif::infra[] |
| 70 | + spec: |
| 71 | + metadata: |
| 72 | + creationTimestamp: null |
| 73 | + labels: |
| 74 | +ifndef::infra[] |
| 75 | + node-role.kubernetes.io/<role>: "" <2> |
| 76 | +endif::infra[] |
| 77 | +ifdef::infra[] |
| 78 | + node-role.kubernetes.io/infra: "" <2> |
| 79 | + taints: <4> |
| 80 | + - key: node-role.kubernetes.io/infra |
| 81 | + effect: NoSchedule |
| 82 | +endif::infra[] |
| 83 | + providerSpec: |
| 84 | + value: |
| 85 | + apiVersion: machine.openshift.io/v1beta1 |
| 86 | + availabilitySet: <availability_set> <6> |
| 87 | + credentialsSecret: |
| 88 | + name: azure-cloud-credentials |
| 89 | + namespace: openshift-machine-api |
| 90 | + image: |
| 91 | + offer: "" |
| 92 | + publisher: "" |
| 93 | + resourceID: /resourceGroups/<infrastructure_id>-rg/providers/Microsoft.Compute/images/<infrastructure_id> <1> |
| 94 | + sku: "" |
| 95 | + version: "" |
| 96 | + internalLoadBalancer: "" |
| 97 | + kind: AzureMachineProviderSpec |
| 98 | +ifndef::infra[] |
| 99 | + location: <region> <4> |
| 100 | +endif::infra[] |
| 101 | +ifdef::infra[] |
| 102 | + location: <region> <5> |
| 103 | +endif::infra[] |
| 104 | + managedIdentity: <infrastructure_id>-identity <1> |
| 105 | + metadata: |
| 106 | + creationTimestamp: null |
| 107 | + natRule: null |
| 108 | + networkResourceGroup: "" |
| 109 | + osDisk: |
| 110 | + diskSizeGB: 128 |
| 111 | + managedDisk: |
| 112 | + storageAccountType: Premium_LRS |
| 113 | + osType: Linux |
| 114 | + publicIP: false |
| 115 | + publicLoadBalancer: "" |
| 116 | + resourceGroup: <infrastructure_id>-rg <1> |
| 117 | + sshPrivateKey: "" |
| 118 | + sshPublicKey: "" |
| 119 | + subnet: <infrastructure_id>-<role>-subnet <1> <2> |
| 120 | + userDataSecret: |
| 121 | + name: worker-user-data <2> |
| 122 | + vmSize: Standard_DS4_v2 |
| 123 | + vnet: <infrastructure_id>-vnet <1> |
| 124 | +ifndef::infra[] |
| 125 | + zone: "1" <5> |
| 126 | +endif::infra[] |
| 127 | +ifdef::infra[] |
| 128 | + zone: "1" <7> |
| 129 | +endif::infra[] |
| 130 | +---- |
| 131 | +<1> Specify the infrastructure ID that is based on the cluster ID that you set when you provisioned the cluster. If you have the OpenShift CLI installed, you can obtain the infrastructure ID by running the following command: |
| 132 | ++ |
| 133 | +[source,terminal] |
| 134 | +---- |
| 135 | +$ oc get -o jsonpath='{.status.infrastructureName}{"\n"}' infrastructure cluster |
| 136 | +---- |
| 137 | ++ |
| 138 | +You can obtain the subnet by running the following command: |
| 139 | ++ |
| 140 | +[source,terminal] |
| 141 | +---- |
| 142 | +$ oc -n openshift-machine-api \ |
| 143 | + -o jsonpath='{.spec.template.spec.providerSpec.value.subnet}{"\n"}' \ |
| 144 | + get machineset/<infrastructure_id>-worker-centralus1 |
| 145 | +---- |
| 146 | +You can obtain the vnet by running the following command: |
| 147 | ++ |
| 148 | +[source,terminal] |
| 149 | +---- |
| 150 | +$ oc -n openshift-machine-api \ |
| 151 | + -o jsonpath='{.spec.template.spec.providerSpec.value.vnet}{"\n"}' \ |
| 152 | + get machineset/<infrastructure_id>-worker-centralus1 |
| 153 | +---- |
| 154 | +ifndef::infra[] |
| 155 | +<2> Specify the node label to add. |
| 156 | +<3> Specify the infrastructure ID, node label, and region. |
| 157 | +<4> Specify the region to place machines on. |
| 158 | +<5> Specify the zone within your region to place machines on. Be sure that your region supports the zone that you specify. |
| 159 | +<6> Specify the availability set for the cluster. |
| 160 | +endif::infra[] |
| 161 | +ifdef::infra[] |
| 162 | +<2> Specify the `<infra>` node label. |
| 163 | +<3> Specify the infrastructure ID, `<infra>` node label, and region. |
| 164 | +<4> Specify a taint to prevent user workloads from being scheduled on infra nodes. |
| 165 | +<5> Specify the region to place machines on. |
| 166 | +<6> Specify the availability set for the cluster. |
| 167 | +<7> Specify the zone within your region to place machines on. Be sure that your region supports the zone that you specify. |
| 168 | +endif::infra[] |
| 169 | + |
| 170 | + |
| 171 | +ifeval::["{context}" == "creating-infrastructure-machinesets"] |
| 172 | +:!infra: |
| 173 | +endif::[] |
| 174 | +ifeval::["{context}" == "cluster-tasks"] |
| 175 | +:!infra: |
| 176 | +endif::[] |
0 commit comments