github.com/openshift/installer@v1.4.17/docs/user/vsphere/install_upi.md (about) 1 # Install: vSphere User Provided Infrastructure 2 3 The steps for performing a UPI-based install are outlined here. Several [Terraform][upi-vsphere-example] templates are provided as an example to help model your own. 4 5 ## Table of contents 6 7 1. Compute 8 9 2. Network topology requirements 10 11 3. DNS requirements 12 13 4. Getting Ignition configs for machines 14 15 5. Getting OS related assets for machines 16 17 6. Configuring RHCOS VMs with Ignition configs 18 19 7. Watching your installation (bootstrap_complete, cluster available) 20 21 8. Example vSphere UPI deployment 22 23 ## Compute 24 25 The smallest OpenShift 4.x clusters require the following VMs: 26 27 * 1 bootstrap machine. 28 29 * 3 control plane machines. 30 31 * at least 1 worker machine. 32 33 NOTE: The cluster requires the bootstrap machine to deploy the OpenShift cluster on to the 3 control plane machines, and you can remove the bootstrap machine. 34 35 The bootstrap and control plane machines must use Red Hat Enterprise Linux CoreOS (RHCOS) as the operating system. 36 37 All of the VMs created must reside within the same folder. See [the note below](#check-folder-name-in-cloud-provider-manifest) for details about folder naming. 38 39 The disk UUID on the VMs must be enabled: the `disk.EnableUUID` value must be set to `True`. This step is necessary so that the VMDK always presents a consistent UUID to the VM, thus allowing the disk to be mounted properly. 40 41 ### Minimum resource requirements 42 43 Processing 44 Memory 45 Storage 46 Networking 47 48 [todo-link-to-minimum-resource-requirements] 49 50 ## Network Topology Requirements 51 52 OpenShift 4.x requires all nodes to have internet access to pull images for platform containers and provide telemetry data to Red Hat. 53 54 ### Load balancers 55 56 Before you install OpenShift, you must provision two load balancers. 57 58 * A load balancer for the control plane machines that targets port 6443 (Kubernetes APIServer) and 22623([Machine Config server][machine-config-server]). Port 6443 must be accessible to both clients external to the cluster and nodes within the cluster, and port 22623 must be accessible to nodes within the cluster. 59 60 * A load balancer for the machines that run the [ingress router][openshift-router] pods that balances ports 443 and 80. Both the ports must be accessible to both clients external to the cluster and nodes within the cluster. 61 62 NOTE: A working configuration for the ingress router is required for an OpenShift 4.x cluster. 63 64 NOTE: The default configuration for Cluster Ingress Operator deploys the ingress router to `worker` nodes in the cluster. The administrator needs to configure the [ingress][openshift-router] after the control plane has been bootstrapped. 65 66 ### Connectivity between machines 67 68 You must configure the network connectivity between machines to allow cluster components to communicate. 69 70 * etcd 71 72 As the etcd members are located on the control plane machines, each control plane machine requires connectivity to [etcd server][etcd-ports], [etcd peer][etcd-ports] and [etcd-metrics][etcd-ports] on every other control plane machine. 73 74 * OpenShift SDN 75 76 All the machines require connectivity to certain reserved ports on every other machine to establish in-cluster networking. For more details, see [this documentation][sdn-ports]. 77 78 * Kubernetes NodePort 79 80 All the machines require connectivity to Kubernetes NodePort range 30000-32767 on every other machine for OpenShift platform components. 81 82 * OpenShift reserved 83 84 All the machines require connectivity to reserved port ranges 10250-12252 and 9000-9999 on every other machine for OpenShift platform components. 85 86 ### Connectivity during machine boot 87 88 All the RHCOS machines require network in `initramfs` during boot to fetch Ignition config from the Machine Config Server [machine-config-server]. During the initial boot, the machines requires a DHCP server in order to establish a network connection to download their Ignition configs. After the initial boot, the machines can be configured to use a static IP address, although it is recommended that you continue to use DHCP to configure IP addresses after the initial boot. 89 90 ## DNS requirements 91 92 * Kubernetes API 93 94 OpenShift 4.x requires the DNS records `api.$cluster_name.$base_domain` and `api-int.$cluster_name.$base_domain` to point to the Load balancer targeting the control plane machines. Both records must be resolvable from all the nodes within the cluster. The `api.$cluster_name.$base_domain` must also be resolvable by clients external to the cluster. 95 96 * etcd 97 98 For each control plane machine, OpenShift 4.x requires DNS records `etcd-$idx.$cluster_name.$base_domain` to point to `$idx`'th control plane machine. The DNS record must resolve to an unicast IPV4 address for the control plane machine and the records must be resolvable from all the nodes in the cluster. 99 100 For each control plane machine, OpenShift 4.x also requires a SRV DNS record for etcd server on that machine with priority `0`, weight `10` and port `2380`. For 3 control plane cluster, the records look like: 101 102 ```plain 103 # _service._proto.name. TTL class SRV priority weight port target. 104 _etcd-server-ssl._tcp.$cluster_name.$base_domain 86400 IN SRV 0 10 2380 etcd-0.$cluster_name.$base_domain. 105 _etcd-server-ssl._tcp.$cluster_name.$base_domain 86400 IN SRV 0 10 2380 etcd-1.$cluster_name.$base_domain. 106 _etcd-server-ssl._tcp.$cluster_name.$base_domain 86400 IN SRV 0 10 2380 etcd-2.$cluster_name.$base_domain. 107 ``` 108 109 * OpenShift Routes 110 111 OpenShift 4.x requires the DNS record `*.apps.$cluster_name.$base_domain` to point to the Load balancer targeting the machines running the ingress router pods. This record must be resolvable by both clients external to the cluster and from all the nodes within the cluster. 112 113 ## Getting ignition configs for machines 114 115 The OpenShift Installer provides administrators various assets that are required to create an OpenShift cluster, namely: 116 117 * Ignition configs: The OpenShift Installer provides Ignition configs that should be used to configure the RHCOS based bootstrap and control plane machines using `bootstrap.ign` and `master.ign` respectively. The OpenShift Installer also provides `worker.ign` that can be used to configure the RHCOS based `worker` machines, but also can be used as source for configuring RHEL based machines [todo-link-to-BYO-RHEL]. 118 119 * Admin Kubeconfig: The OpenShift Installer provides a kubeconfig with admin level privileges to Kubernetes APIServer. 120 121 NOTE: This kubeconfig is configured to use `api.$cluster_name.$base_domain` DNS name to communicate with the Kubernetes APIServer. 122 123 ### Setting up install-config for installer 124 125 The OpenShift installer uses an [Install Config](../customization.md#platform-customization) to drive all install time configuration. 126 127 An example install config for vSphere UPI is as follows: 128 129 ```yaml 130 apiVersion: v1 131 ## The base domain of the cluster. All DNS records will be sub-domains of this base and will also include the cluster name. 132 baseDomain: example.com 133 compute: 134 - name: worker 135 replicas: 1 136 controlPlane: 137 name: master 138 replicas: 3 139 metadata: 140 ## The name for the cluster 141 name: test 142 platform: 143 vsphere: 144 ## The hostname or IP address of the vCenter 145 vCenter: your.vcenter.server 146 ## The name of the user for accessing the vCenter 147 username: your_vsphere_username 148 ## The password associated with the user 149 password: your_vsphere_password 150 ## The datacenter in the vCenter 151 datacenter: your_datacenter 152 ## The default datastore to use. 153 defaultDatastore: your_datastore 154 ## The pull secret that provides components in the cluster access to images for OpenShift components. 155 pullSecret: '' 156 ## The default SSH key that will be programmed for `core` user. 157 sshKey: '' 158 ``` 159 160 Create a directory that will be used by the OpenShift installer to provide all the assets. For example `test-vsphere`, 161 162 ```console 163 $ mkdir test-vsphere 164 $ tree test-vsphere 165 test-vsphere 166 167 0 directories, 0 files 168 ``` 169 170 Copy *your* `install-config` to the `INSTALL_DIR`. For example using the `test-vsphere` as our `INSTALL_DIR`, 171 172 ```console 173 $ cp <your-instal-config> test-vsphere/install-config.yaml 174 $ tree test-vsphere 175 test-vsphere 176 └── install-config.yaml 177 178 0 directories, 1 file 179 ``` 180 181 NOTE: The filename for `install-config` in the `INSTALL_DIR` must be `install-config.yaml` 182 183 ### Invoking the installer to get manifests 184 Given that you have setup the `INSTALL_DIR` with the appropriate `install-config.yaml`, you can create manifests by using the `create manifests` target. For example, 185 186 ```console 187 $ openshift-install --dir vsphere-test create manifests 188 INFO Consuming Install Config from target directory 189 ``` 190 This produces two directories which contain many manifests that will be used for installation. 191 ``` 192 $ tree vsphere-test -d 193 vsphere-test 194 ├── manifests 195 └── openshift 196 197 2 directories 198 ``` 199 200 #### Remove Machines and MachineSets 201 202 Some of the manifests produced are for creating machinesets and machine objects: 203 204 ``` 205 $ find vsphere-test -name '*machineset*' -o -name '*master-machine*' 206 vsphere-test/openshift/99_openshift-cluster-api_master-machines-1.yaml 207 vsphere-test/openshift/99_openshift-cluster-api_master-machines-2.yaml 208 vsphere-test/openshift/99_openshift-cluster-api_master-machines-0.yaml 209 vsphere-test/openshift/99_openshift-cluster-api_worker-machineset-0.yaml 210 ``` 211 212 We should remove these, because we don't want to involve [the machine-API operator][machine-api-operator] during install. 213 214 From within the `INSTALL_DIR`: 215 ```console 216 $ rm -f openshift/99_openshift-cluster-api_master-machines-*.yaml openshift/99_openshift-cluster-api_worker-machineset-*.yaml 217 ``` 218 219 #### Check Folder Name in Cloud Provider Manifest 220 221 An absolute path to the cluster VM folder is specified in the `cloud-provider-config.yaml` manifest. The vSphere Cloud Provider uses the specified folder for cluster operations, such as provisioning volumes. The folder path can be specified in the install-config (see [customization.md](customization.md)) or the default value will be a top-level folder named with the infrastructure ID. 222 223 ```console 224 $ cat vsphere-test/manifests/cloud-provider-config.yaml | grep folder 225 folder = "/<datacenter>/vm/test-kndtw" 226 ``` 227 228 For successful cluster operation, VMs will need to be created in a folder matching the path specified in the cloud-provider config. 229 230 ### Invoking the installer to get Ignition configs 231 232 Given that you have setup the `INSTALL_DIR` with the appropriate manifests, you can create the Ignition configs by using the `create ignition-configs` target. For example, 233 234 ```console 235 $ openshift-install --dir test-vsphere create ignition-configs 236 INFO Consuming "Install Config" from target directory 237 $ tree test-vsphere 238 test-vsphere 239 ├── auth 240 │ └── kubeconfig 241 ├── bootstrap.ign 242 ├── master.ign 243 ├── metadata.json 244 └── worker.ign 245 246 1 directory, 5 files 247 248 ``` 249 250 ## Getting OS related assets for machines 251 252 TODO RHEL CoreOS does not have assets for vSphere. 253 254 ## Configuring RHCOS VMs with Ignition configs 255 256 Set the vApp properties of the VM to set the Ignition config for the VM. The `guestinfo.ignition.config.data` property is the base64-encoded Ignition config. The `guestinfo.ignition.config.data.encoding` should be set to `base64`. 257 258 ### Control Plane and Worker VMs 259 260 The Ignition configs supplied in the vApp properties of the control plane and worker VMs should be copies of the `master.ign` and `worker.ign` created by the OpenShift Installer. 261 262 ### Bootstrap VM 263 264 The Ignition config supplied in the vApp properties of the bootstrap VM should be an Ignition config that has a URL from which the bootstrap VM can download the `bootstrap.ign` created by the OpenShift Installer. Note that the URL must be accessible by the bootstrap VM. 265 266 The Ignition config created by the OpenShift Installer cannot be used directly because there is a size limit on the length of vApp properties, and the Ignition config will exceed that size limit. 267 268 ```json 269 { 270 "ignition": { 271 "config": { 272 "merge": [ 273 { 274 "source": "bootstrap_ignition_config_url", 275 } 276 ] 277 }, 278 "version": "3.1.0" 279 }, 280 } 281 ``` 282 283 ## Configuring Hostname and Static IP Addresses with Afterburn 284 285 The hostname of each control plane and worker machine must be resolvable from all nodes within the cluster. 286 287 Preferably, the hostname and IP address will be set via DHCP. 288 289 If you need to manually set a hostname and/or configure a static IP address, you can pass a custom networking command-line `ip=` parameter to Afterburn for configuration. In order to do so, set the vApp property `guestinfo.afterburn.initrd.network-kargs` to the `ip` parameter using this format: `ip=<ip_address>::<gateway>:<netmask>:<hostname>:<iface>:<protocol>:<dns_address>`, e.g. `ip=10.0.0.2::10.0.0.2:255.255.255.0:compute-1:ens192:none:8.8.8.8` 290 291 The full syntax of the `ip=` parameter is documented in the [Dracut manpages](https://www.man7.org/linux/man-pages/man7/dracut.cmdline.7.html). 292 293 ## Watching your installation 294 295 ### Monitor for bootstrap-complete 296 297 The administrators can use the `wait-for bootstrap-complete` command of the OpenShift Installer to monitor cluster bootstrapping. The command succeeds when it notices `bootstrap-complete` event from Kubernetes APIServer. This event is generated by the bootstrap machine after the Kubernetes APIServer has been bootstrapped on the control plane machines. For example, 298 299 ```console 300 $ openshift-install --dir test-vsphere wait-for bootstrap-complete 301 INFO Waiting up to 30m0s for the Kubernetes API at https://api.test.example.com:6443... 302 INFO API v1.12.4+c53f462 up 303 INFO Waiting up to 30m0s for the bootstrap-complete event... 304 ``` 305 306 ### Monitor for install completion 307 308 The administrators can use the `wait-for install-complete` command of the OpenShift Installer to monitor install completion. The command succeeds when it notices that Cluster Version Operator has completed rolling out the OpenShift cluster from Kubernetes APIServer. 309 310 ```console 311 $ openshift-install --dir test-vsphere wait-for install-complete 312 INFO Waiting up to 30m0s for the cluster to initialize... 313 ``` 314 315 ## Example vSphere UPI deployment 316 317 Terraform [templates][upi-vsphere-example] are provided as an example of using OpenShift Installer to create a vSphere UPI OpenShift cluster. 318 319 ### Overview 320 321 * Compute: 322 Uses `public` IPv4 addresses for each machine, so that all the machines are accessible on the Internet. 323 324 * DNS and Load Balancing 325 Uses AWS [Route53](aws-route53) to configure the all the DNS records. 326 Uses Round-Robin DNS [RRDNS][rrdns] in place of load balancing solutions. 327 328 Refer to the pre-requisites for using the example [here][upi-vsphere-example-pre-req] 329 330 ### Creating the cluster 331 332 #### Installer assets 333 334 Use the OpenShift Installer to create [Ignition configs](#getting-ignition-configs-for-machines) that will be used to create bootstrap, control plane and worker machines. 335 336 #### Terraform variable file 337 338 Use the [example][upi-vsphere-example-tfvar] `create_tfvars.sh` script to create a Terraform variable file, and edit the `tfvars` file on your favorite editor. 339 340 ```sh 341 cd test-vsphere 342 create_tfvars.sh 343 ``` 344 345 At a minimum, you need to set values for the following variables. 346 * cluster_id 347 * cluster_domain 348 * vsphere_user 349 * vsphere_password 350 * ipam_token OR bootstrap_ip, control_plane_ips, and compute_ips 351 352 Move the `tfvars` file to the directory with the example Terraform. 353 354 #### Creating resources 355 356 Initialize terraform to download all the required providers. For more info on terraform [init][terraform-init] and terraform [providers][terraform-providers] 357 358 ```sh 359 terraform init 360 ``` 361 362 Create all the resources using terraform by invoking [apply][terraform-apply] 363 364 ```sh 365 terraform apply -auto-approve 366 ``` 367 368 #### Monitoring bootstrap-complete and removing bootstrap resources 369 370 Use the bootstrap [monitoring](#monitor-for-bootstrap-complete) to track when cluster bootstrapping has finished. After the Kubernetes APIServer has been bootstrapped on the control plane machines, the bootstrap VM can be destroyed by following: 371 372 ```sh 373 terraform apply -auto-approve -var 'bootstrap_complete=true' 374 ``` 375 376 ### Approving server certificates for nodes 377 378 To allow Kube APIServer to communicate with the kubelet running on nodes for logs, rsh etc. The administrator needs to approve the CSR [requests][csr-requests] generated by each kubelet. 379 380 You can approve all `Pending` CSR requests using, 381 382 ```sh 383 oc get csr -ojson | jq -r '.items[] | select(.status == {} ) | .metadata.name' | xargs oc adm certificate approve 384 ``` 385 386 ### Updating image-registry to emptyDir storage backend 387 388 The Cluster Image Registry [Operator][cluster-image-registry-operator] does not pick an storage backend for `vSphere` platform. Therefore, the cluster operator will be stuck in progressing because it is waiting for administrator to [configure][cluster-image-registry-operator-configuration] a storage backend for the image-registry. You can pick `emptyDir` for non-production clusters by following: 389 390 ```sh 391 oc patch configs.imageregistry.operator.openshift.io cluster --type merge --patch '{"spec":{"storage":{"emptyDir":{}}}}' 392 ``` 393 394 #### Monitoring cluster completion 395 396 Use the cluster finish [monitoring](#monitor-for-install-completion) to track when cluster has completely finished deploying. 397 398 #### Destroying the cluster 399 400 Use terraform [destroy][terraform-destroy] to destroy all the resources for the cluster. For example, 401 402 ```console 403 terraform destroy -auto-approve 404 ``` 405 406 [aws-route53]: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/Welcome.html 407 [cluster-image-registry-operator-configuration]: https://github.com/openshift/cluster-image-registry-operator#registry-resource 408 [cluster-image-registry-operator]: https://github.com/openshift/cluster-image-registry-operator#image-registry-operator 409 [csr-requests]: https://kubernetes.io/docs/tasks/tls/managing-tls-in-a-cluster/#requesting-a-certificate 410 [etcd-ports]: https://github.com/openshift/origin/pull/21520 411 [machine-config-server]: https://github.com/openshift/machine-config-operator/blob/master/docs/MachineConfigServer.md 412 [openshift-router]: https://github.com/openshift/cluster-ingress-operator#openshift-ingress-operator 413 [rrdns]: https://tools.ietf.org/html/rfc1794 414 [sdn-ports]: https://github.com/openshift/origin/pull/21520 415 [terraform-apply]: https://www.terraform.io/docs/commands/apply.html 416 [terraform-destroy]: https://www.terraform.io/docs/commands/destroy.html 417 [terraform-init]: https://www.terraform.io/docs/commands/init.html 418 [terraform-providers]: https://www.terraform.io/docs/providers/ 419 [upi-vsphere-example-pre-req]: ../../../upi/vsphere/README.md#pre-requisites 420 [upi-vsphere-example-tfvar]: ../../../upi/vsphere/terraform.tfvars.example 421 [upi-vsphere-example]: ../../../upi/vsphere/README.md