|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * post_installation_configuration/node-tasks.adoc |
| 4 | + |
| 5 | +:_content-type: PROCEDURE |
| 6 | +[id="nodes-vsphere-machine-set-scaling-static-ip_{context}"] |
| 7 | += Using a machine set to scale machines with configured static IP addresses |
| 8 | + |
| 9 | +You can use a machine set to scale machines with configured static IP addresses. |
| 10 | + |
| 11 | +:FeatureName: Static IP addresses for vSphere nodes |
| 12 | +include::snippets/technology-preview.adoc[leveloffset=+1] |
| 13 | + |
| 14 | +The example in the procedure demonstrates the use of controllers for scaling machines in a machine set. |
| 15 | + |
| 16 | +.Prerequisites |
| 17 | + |
| 18 | +* You included `featureSet:TechPreviewNoUpgrade` as the initial entry in the `install-config.yaml` file. |
| 19 | +* You deployed a cluster that runs at least one node with a configured static IP address. |
| 20 | +
|
| 21 | +.Procedure |
| 22 | +. Configure a machine set by specifying IP pool information in the `network.devices.addressesFromPools` schema of the machine set's YAML file: |
| 23 | ++ |
| 24 | +[source,yaml] |
| 25 | +---- |
| 26 | +apiVersion: machine.openshift.io/v1beta1 |
| 27 | +kind: MachineSet |
| 28 | +metadata: |
| 29 | + annotations: |
| 30 | + machine.openshift.io/memoryMb: "8192" |
| 31 | + machine.openshift.io/vCPU: "4" |
| 32 | + labels: |
| 33 | + machine.openshift.io/cluster-api-cluster: <infrastructure_id> |
| 34 | + name: <infrastructure_id>-<role> |
| 35 | + namespace: openshift-machine-api |
| 36 | +spec: |
| 37 | + replicas: 0 |
| 38 | + selector: |
| 39 | + matchLabels: |
| 40 | + machine.openshift.io/cluster-api-cluster: <infrastructure_id> |
| 41 | + machine.openshift.io/cluster-api-machineset: <infrastructure_id>-<role> |
| 42 | + template: |
| 43 | + metadata: |
| 44 | + labels: |
| 45 | + ipam: "true" |
| 46 | + machine.openshift.io/cluster-api-cluster: <infrastructure_id> |
| 47 | + machine.openshift.io/cluster-api-machine-role: worker |
| 48 | + machine.openshift.io/cluster-api-machine-type: worker |
| 49 | + machine.openshift.io/cluster-api-machineset: <infrastructure_id>-<role> |
| 50 | + spec: |
| 51 | + lifecycleHooks: {} |
| 52 | + metadata: {} |
| 53 | + providerSpec: |
| 54 | + value: |
| 55 | + apiVersion: machine.openshift.io/v1beta1 |
| 56 | + credentialsSecret: |
| 57 | + name: vsphere-cloud-credentials |
| 58 | + diskGiB: 120 |
| 59 | + kind: VSphereMachineProviderSpec |
| 60 | + memoryMiB: 8192 |
| 61 | + metadata: {} |
| 62 | + network: |
| 63 | + devices: |
| 64 | + - addressesFromPools: <1> |
| 65 | + - group: ipamcontroller.example.io |
| 66 | + name: static-ci-pool |
| 67 | + resource: IPPool |
| 68 | + nameservers: |
| 69 | + - "192.168.204.1" <2> |
| 70 | + networkName: qe-segment-204 |
| 71 | + numCPUs: 4 |
| 72 | + numCoresPerSocket: 2 |
| 73 | + snapshot: "" |
| 74 | + template: rvanderp4-dev-9n5wg-rhcos-generated-region-generated-zone |
| 75 | + userDataSecret: |
| 76 | + name: worker-user-data |
| 77 | + workspace: |
| 78 | + datacenter: IBMCdatacenter |
| 79 | + datastore: /IBMCdatacenter/datastore/vsanDatastore |
| 80 | + folder: /IBMCdatacenter/vm/rvanderp4-dev-9n5wg |
| 81 | + resourcePool: /IBMCdatacenter/host/IBMCcluster//Resources |
| 82 | + server: vcenter.ibmc.devcluster.openshift.com |
| 83 | +---- |
| 84 | +<1> Specifies an IP pool, which lists a static IP address or a range of static IP addresses. The IP Pool can either be a reference to a custom resource definition (CRD) or a resource supported by the `IPAddressClaims` resource handler. The machine controller accesses static IP addresses listed in the machine set's configuration and then allocates each address to each machine. |
| 85 | +<2> Lists a nameserver. You must specify a nameserver for nodes that receive static IP address, because the Dynamic Host Configuration Protocol (DHCP) network configuration does not support static IP addresses. |
| 86 | + |
| 87 | +. Scale the machine set by entering the following commands in your `oc` CLI: |
| 88 | ++ |
| 89 | +[source, terminal] |
| 90 | +---- |
| 91 | +$ oc scale --replicas=2 machineset <machineset> -n openshift-machine-api |
| 92 | +---- |
| 93 | ++ |
| 94 | +Or: |
| 95 | ++ |
| 96 | +[source, terminal] |
| 97 | +---- |
| 98 | +$ oc edit machineset <machineset> -n openshift-machine-api |
| 99 | +---- |
| 100 | ++ |
| 101 | +After each machine is scaled up, the machine controller creates an `IPAddresssClaim` resource. |
| 102 | + |
| 103 | +. Optional: Check that the `IPAddressClaim` resource exists in the `openshift-machine-api` namespace by entering the following command: |
| 104 | ++ |
| 105 | +[source, terminal] |
| 106 | +---- |
| 107 | +$ oc get ipaddressclaims.ipam.cluster.x-k8s.io -n openshift-machine-api |
| 108 | +---- |
| 109 | ++ |
| 110 | +.Example `oc` CLI output that lists two IP pools listed in the `openshift-machine-api` namespace |
| 111 | +[source, terminal] |
| 112 | +---- |
| 113 | +NAME POOL NAME POOL KIND |
| 114 | +cluster-dev-9n5wg-worker-0-m7529-claim-0-0 static-ci-pool IPPool |
| 115 | +cluster-dev-9n5wg-worker-0-wdqkt-claim-0-0 static-ci-pool IPPool |
| 116 | +---- |
| 117 | + |
| 118 | +. Create an `IPAddress` resource by entering the following command: |
| 119 | ++ |
| 120 | +[source, terminal] |
| 121 | +---- |
| 122 | +$ oc create -f ipaddress.yaml |
| 123 | +---- |
| 124 | ++ |
| 125 | +The following example shows an `IPAddress` resource with defined network configuration information and one defined static IP address: |
| 126 | ++ |
| 127 | +[source,yaml] |
| 128 | +---- |
| 129 | +apiVersion: ipam.cluster.x-k8s.io/v1alpha1 |
| 130 | +kind: IPAddress |
| 131 | +metadata: |
| 132 | + name: cluster-dev-9n5wg-worker-0-m7529-ipaddress-0-0 |
| 133 | + namespace: openshift-machine-api |
| 134 | +spec: |
| 135 | + address: 192.168.204.129 |
| 136 | + claimRef: <1> |
| 137 | + name: cluster-dev-9n5wg-worker-0-m7529-claim-0-0 |
| 138 | + gateway: 192.168.204.1 |
| 139 | + poolRef: <2> |
| 140 | + apiGroup: ipamcontroller.example.io |
| 141 | + kind: IPPool |
| 142 | + name: static-ci-pool |
| 143 | + prefix: 23 |
| 144 | +---- |
| 145 | +<1> The name of the target `IPAddressClaim` resource. |
| 146 | +<2> Details information about the static IP address or addresses from your nodes. |
| 147 | ++ |
| 148 | +[NOTE] |
| 149 | +==== |
| 150 | +By default, the external controller automatically scans any resources in the machine set for recognizable address pool types. When the external controller finds `kind: IPPool` defined in the `IPAddress` resource, the controller binds any static IP addresses to the `IPAddressClaim` resource. |
| 151 | +==== |
| 152 | + |
| 153 | +. Update the `IPAddressClaim` status with a reference to the `IPAddress` resource: |
| 154 | ++ |
| 155 | +[source, terminal] |
| 156 | +---- |
| 157 | +$ oc --type=merge patch IPAddressClaim cluster-dev-9n5wg-worker-0-m7529-claim-0-0 -p='{"status":{"addressRef": {"name": "cluster-dev-9n5wg-worker-0-m7529-ipaddress-0-0"}}}' -n openshift-machine-api --subresource=status |
| 158 | +---- |
0 commit comments