Installing a cluster on vSphere in a restricted network

In OKD 4, you can install a cluster on VMware vSphere infrastructure in a restricted network by creating an internal mirror of the installation release content.

OKD supports deploying a cluster to a single VMware vCenter only. Deploying a cluster with machines/machine sets on multiple vCenters is not supported.

Prerequisites

  • You reviewed details about the OKD installation and update processes.

  • You read the documentation on selecting a cluster installation method and preparing it for users.

  • You created a registry on your mirror host and obtained the imageContentSources data for your version of OKD.

    Because the installation media is on the mirror host, you can use that computer to complete all installation steps.

  • You provisioned persistent storage for your cluster. To deploy a private image registry, your storage must provide the ReadWriteMany access mode.

  • The OKD installer requires access to port 443 on the vCenter and ESXi hosts. You verified that port 443 is accessible.

  • If you use a firewall, you confirmed with the administrator that port 443 is accessible. Control plane nodes must be able to reach vCenter and ESXi hosts on port 443 for the installation to succeed.

  • If you use a firewall and plan to use the Telemetry service, you configured the firewall to allow the sites that your cluster requires access to.

    If you are configuring a proxy, be sure to also review this site list.

About installations in restricted networks

In OKD 4, you can perform an installation that does not require an active connection to the internet to obtain software components. Restricted network installations can be completed using installer-provisioned infrastructure or user-provisioned infrastructure, depending on the cloud platform to which you are installing the cluster.

If you choose to perform a restricted network installation on a cloud platform, you still require access to its cloud APIs. Some cloud functions, like Amazon Web Service’s Route 53 DNS and IAM services, require internet access. Depending on your network, you might require less internet access for an installation on bare metal hardware, Nutanix, or on VMware vSphere.

To complete a restricted network installation, you must create a registry that mirrors the contents of the OpenShift image registry and contains the installation media. You can create this registry on a mirror host, which can access both the internet and your closed network, or by using other methods that meet your restrictions.

Additional limits

Clusters in restricted networks have the following additional limitations and restrictions:

  • The ClusterVersion status includes an Unable to retrieve available updates error.

  • By default, you cannot use the contents of the Developer Catalog because you cannot access the required image stream tags.

Generating a key pair for cluster node SSH access

During an OKD installation, you can provide an SSH public key to the installation program. The key is passed to the Fedora CoreOS (FCOS) nodes through their Ignition config files and is used to authenticate SSH access to the nodes. The key is added to the ~/.ssh/authorized_keys list for the core user on each node, which enables password-less authentication.

After the key is passed to the nodes, you can use the key pair to SSH in to the FCOS nodes as the user core. To access the nodes through SSH, the private key identity must be managed by SSH for your local user.

If you want to SSH in to your cluster nodes to perform installation debugging or disaster recovery, you must provide the SSH public key during the installation process. The ./openshift-install gather command also requires the SSH public key to be in place on the cluster nodes.

Do not skip this procedure in production environments, where disaster recovery and debugging is required.

You must use a local key, not one that you configured with platform-specific approaches such as AWS key pairs.

On clusters running Fedora CoreOS (FCOS), the SSH keys specified in the Ignition config files are written to the /home/core/.ssh/authorized_keys.d/core file. However, the Machine Config Operator manages SSH keys in the /home/core/.ssh/authorized_keys file and configures sshd to ignore the /home/core/.ssh/authorized_keys.d/core file. As a result, newly provisioned OKD nodes are not accessible using SSH until the Machine Config Operator reconciles the machine configs with the authorized_keys file. After you can access the nodes using SSH, you can delete the /home/core/.ssh/authorized_keys.d/core file.

Procedure

  1. If you do not have an existing SSH key pair on your local machine to use for authentication onto your cluster nodes, create one. For example, on a computer that uses a Linux operating system, run the following command:

    1. $ ssh-keygen -t ed25519 -N '' -f <path>/<file_name> (1)
    1Specify the path and file name, such as ~/.ssh/id_ed25519, of the new SSH key. If you have an existing key pair, ensure your public key is in the your ~/.ssh directory.

    If you plan to install an OKD cluster that uses the Fedora cryptographic libraries that have been submitted to NIST for FIPS 140-2/140-3 Validation on only the x86_64, ppc64le, and s390x architectures, do not create a key that uses the ed25519 algorithm. Instead, create a key that uses the rsa or ecdsa algorithm.

  2. View the public SSH key:

    1. $ cat <path>/<file_name>.pub

    For example, run the following to view the ~/.ssh/id_ed25519.pub public key:

    1. $ cat ~/.ssh/id_ed25519.pub
  3. Add the SSH private key identity to the SSH agent for your local user, if it has not already been added. SSH agent management of the key is required for password-less SSH authentication onto your cluster nodes, or if you want to use the ./openshift-install gather command.

    On some distributions, default SSH private key identities such as ~/.ssh/id_rsa and ~/.ssh/id_dsa are managed automatically.

    1. If the ssh-agent process is not already running for your local user, start it as a background task:

      1. $ eval "$(ssh-agent -s)"

      Example output

      1. Agent pid 31874

      If your cluster is in FIPS mode, only use FIPS-compliant algorithms to generate the SSH key. The key must be either RSA or ECDSA.

  4. Add your SSH private key to the ssh-agent:

    1. $ ssh-add <path>/<file_name> (1)
    1Specify the path and file name for your SSH private key, such as ~/.ssh/id_ed25519

    Example output

    1. Identity added: /home/<you>/<path>/<file_name> (<computer_name>)

Next steps

  • When you install OKD, provide the SSH public key to the installation program.

Adding vCenter root CA certificates to your system trust

Because the installation program requires access to your vCenter’s API, you must add your vCenter’s trusted root CA certificates to your system trust before you install an OKD cluster.

Procedure

  1. From the vCenter home page, download the vCenter’s root CA certificates. Click Download trusted root CA certificates in the vSphere Web Services SDK section. The <vCenter>/certs/download.zip file downloads.

  2. Extract the compressed file that contains the vCenter root CA certificates. The contents of the compressed file resemble the following file structure:

    1. certs
    2. ├── lin
    3. ├── 108f4d17.0
    4. ├── 108f4d17.r1
    5. ├── 7e757f6a.0
    6. ├── 8e4f8471.0
    7. └── 8e4f8471.r0
    8. ├── mac
    9. ├── 108f4d17.0
    10. ├── 108f4d17.r1
    11. ├── 7e757f6a.0
    12. ├── 8e4f8471.0
    13. └── 8e4f8471.r0
    14. └── win
    15. ├── 108f4d17.0.crt
    16. ├── 108f4d17.r1.crl
    17. ├── 7e757f6a.0.crt
    18. ├── 8e4f8471.0.crt
    19. └── 8e4f8471.r0.crl
    20. 3 directories, 15 files
  3. Add the files for your operating system to the system trust. For example, on a Fedora operating system, run the following command:

    1. # cp certs/lin/* /etc/pki/ca-trust/source/anchors
  4. Update your system trust. For example, on a Fedora operating system, run the following command:

    1. # update-ca-trust extract

Creating the FCOS image for restricted network installations

Download the Fedora CoreOS (FCOS) image to install OKD on a restricted network VMware vSphere environment.

Prerequisites

  • Obtain the OKD installation program. For a restricted network installation, the program is on your mirror registry host.

Procedure

  1. Log in to the Red Hat Customer Portal’s Product Downloads page.

  2. Under Version, select the most recent release of OKD 4 for RHEL 8.

    The FCOS images might not change with every release of OKD. You must download images with the highest version that is less than or equal to the OKD version that you install. Use the image versions that match your OKD version if they are available.

  3. Download the Fedora CoreOS (FCOS) - vSphere image.

  4. Upload the image you downloaded to a location that is accessible from the bastion server.

The image is now available for a restricted installation. Note the image name or location for use in OKD deployment.

VMware vSphere region and zone enablement

You can deploy an OKD cluster to multiple vSphere datacenters that run in a single VMware vCenter. Each datacenter can run multiple clusters. This configuration reduces the risk of a hardware failure or network outage that can cause your cluster to fail.

The VMware vSphere region and zone enablement feature requires the vSphere Container Storage Interface (CSI) driver as the default storage driver in the cluster. As a result, the feature only available on a newly installed cluster.

A cluster that was upgraded from a previous release defaults to using the in-tree vSphere driver, so you must enable CSI automatic migration for the cluster. You can then configure multiple regions and zones for the upgraded cluster.

The default installation configuration deploys a cluster to a single vSphere datacenter. If you want to deploy a cluster to multiple vSphere datacenters, you must create an installation configuration file that enables the region and zone feature.

The default install-config.yaml file includes vcenters and failureDomains fields, where you can specify multiple vSphere datacenters and clusters for your OKD cluster. You can leave these fields blank if you want to install an OKD cluster in a vSphere environment that consists of single datacenter.

The following list describes terms associated with defining zones and regions for your cluster:

  • Failure domain: Establishes the relationships between a region and zone. You define a failure domain by using vCenter objects, such as a datastore object. A failure domain defines the vCenter location for OKD cluster nodes.

  • Region: Specifies a vCenter datacenter. You define a region by using a tag from the openshift-region tag category.

  • Zone: Specifies a vCenter cluster. You define a zone by using a tag from the openshift-zone tag category.

If you plan on specifying more than one failure domain in your install-config.yaml file, you must create tag categories, zone tags, and region tags in advance of creating the configuration file.

You must create a vCenter tag for each vCenter datacenter, which represents a region. Additionally, you must create a vCenter tag for each cluster than runs in a datacenter, which represents a zone. After you create the tags, you must attach each tag to their respective datacenters and clusters.

The following table outlines an example of the relationship among regions, zones, and tags for a configuration with multiple vSphere datacenters running in a single VMware vCenter.

Datacenter (region)Cluster (zone)Tags

us-east

us-east-1

us-east-1a

us-east-1b

us-east-2

us-east-2a

us-east-2b

us-west

us-west-1

us-west-1a

us-west-1b

us-west-2

us-west-2a

us-west-2b

Additional resources

Creating the installation configuration file

You can customize the OKD cluster you install on VMware vSphere.

Prerequisites

  • You have the OKD installation program and the pull secret for your cluster. For a restricted network installation, these files are on your mirror host.

  • You have the imageContentSources values that were generated during mirror registry creation.

  • You have obtained the contents of the certificate for your mirror registry.

  • You have retrieved a Fedora CoreOS (FCOS) image and uploaded it to an accessible location.

Procedure

  1. Create the install-config.yaml file.

    1. Change to the directory that contains the installation program and run the following command:

      1. $ ./openshift-install create install-config --dir <installation_directory> (1)
      1For <installation_directory>, specify the directory name to store the files that the installation program creates.

      When specifying the directory:

      • Verify that the directory has the execute permission. This permission is required to run Terraform binaries under the installation directory.

      • Use an empty directory. Some installation assets, such as bootstrap X.509 certificates, have short expiration intervals, therefore you must not reuse an installation directory. If you want to reuse individual files from another cluster installation, you can copy them into your directory. However, the file names for the installation assets might change between releases. Use caution when copying installation files from an earlier OKD version.

        Always delete the ~/.powervs directory to avoid reusing a stale configuration. Run the following command:

        1. $ rm -rf ~/.powervs
    2. At the prompts, provide the configuration details for your cloud:

      1. Optional: Select an SSH key to use to access your cluster machines.

        For production OKD clusters on which you want to perform installation debugging or disaster recovery, specify an SSH key that your ssh-agent process uses.

      2. Select vsphere as the platform to target.

      3. Specify the name of your vCenter instance.

      4. Specify the user name and password for the vCenter account that has the required permissions to create the cluster.

        The installation program connects to your vCenter instance.

      5. Select the data center in your vCenter instance to connect to.

        After you create the installation configuration file, you can modify the file to create a multiple vSphere datacenters environment. This means that you can deploy an OKD cluster to multiple vSphere datacenters that run in a single VMware vCenter. For more information about creating this environment, see the section named VMware vSphere region and zone enablement.

      6. Select the default vCenter datastore to use.

        You can specify the path of any datastore that exists in a datastore cluster. By default, Storage Distributed Resource Scheduler (SDRS), which uses Storage vMotion, is automatically enabled for a datastore cluster. Red Hat does not support Storage vMotion, so you must disable Storage DRS to avoid data loss issues for your OKD cluster.

        You cannot specify more than one datastore path. If you must specify VMs across multiple datastores, use a datastore object to specify a failure domain in your cluster’s install-config.yaml configuration file. For more information, see “VMware vSphere region and zone enablement”.

      7. Select the vCenter cluster to install the OKD cluster in. The installation program uses the root resource pool of the vSphere cluster as the default resource pool.

      8. Select the network in the vCenter instance that contains the virtual IP addresses and DNS records that you configured.

      9. Enter the virtual IP address that you configured for control plane API access.

      10. Enter the virtual IP address that you configured for cluster ingress.

      11. Enter the base domain. This base domain must be the same one that you used in the DNS records that you configured.

      12. Enter a descriptive name for your cluster.

        The cluster name you enter must match the cluster name you specified when configuring the DNS records.

  1. In the install-config.yaml file, set the value of platform.vsphere.clusterOSImage to the image location or name. For example:

    1. platform:
    2. vsphere:
    3. clusterOSImage: http://mirror.example.com/images/rhcos-43.81.201912131630.0-vmware.x86_64.ova?sha256=ffebbd68e8a1f2a245ca19522c16c86f67f9ac8e4e0c1f0a812b068b16f7265d
  2. Edit the install-config.yaml file to give the additional information that is required for an installation in a restricted network.

    1. Update the pullSecret value to contain the authentication information for your registry:

      1. pullSecret: '{"auths":{"<mirror_host_name>:5000": {"auth": "<credentials>","email": "you@example.com"}}}'

      For <mirror_host_name>, specify the registry domain name that you specified in the certificate for your mirror registry, and for <credentials>, specify the base64-encoded user name and password for your mirror registry.

    2. Add the additionalTrustBundle parameter and value.

      1. additionalTrustBundle: |
      2. -----BEGIN CERTIFICATE-----
      3. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
      4. -----END CERTIFICATE-----

      The value must be the contents of the certificate file that you used for your mirror registry. The certificate file can be an existing, trusted certificate authority, or the self-signed certificate that you generated for the mirror registry.

    3. Add the image content resources, which resemble the following YAML excerpt:

      1. imageContentSources:
      2. - mirrors:
      3. - <mirror_host_name>:5000/<repo_name>/release
      4. source: quay.io/openshift-release-dev/ocp-release
      5. - mirrors:
      6. - <mirror_host_name>:5000/<repo_name>/release
      7. source: registry.redhat.io/ocp/release

      For these values, use the imageContentSources that you recorded during mirror registry creation.

    4. Optional: Set the publishing strategy to Internal:

      1. publish: Internal

      By setting this option, you create an internal Ingress Controller and a private load balancer.

      Azure Firewall does not work seamlessly with Azure Public Load balancers. Thus, when using Azure Firewall for restricting internet access, the publish field in install-config.yaml should be set to Internal.

  3. Make any other modifications to the install-config.yaml file that you require. You can find more information about the available parameters in the Installation configuration parameters section.

  4. Back up the install-config.yaml file so that you can use it to install multiple clusters.

    The install-config.yaml file is consumed during the installation process. If you want to reuse the file, you must back it up now.

Additional resources

Sample install-config.yaml file for an installer-provisioned VMware vSphere cluster

You can customize the install-config.yaml file to specify more details about your OKD cluster’s platform or modify the values of the required parameters.

  1. apiVersion: v1
  2. baseDomain: example.com (1)
  3. compute: (2)
  4. - architecture: amd64
  5. name: <worker_node>
  6. platform: {}
  7. replicas: 3
  8. controlPlane: (2)
  9. architecture: amd64
  10. name: <parent_node>
  11. platform: {}
  12. replicas: 3
  13. metadata:
  14. creationTimestamp: null
  15. name: test (3)
  16. platform:
  17. vsphere: (4)
  18. apiVIPs:
  19. - 10.0.0.1
  20. failureDomains: (5)
  21. - name: <failure_domain_name>
  22. region: <default_region_name>
  23. server: <fully_qualified_domain_name>
  24. topology:
  25. computeCluster: "/<datacenter>/host/<cluster>"
  26. datacenter: <datacenter>
  27. datastore: "/<datacenter>/datastore/<datastore>" (6)
  28. networks:
  29. - <VM_Network_name>
  30. resourcePool: "/<datacenter>/host/<cluster>/Resources/<resourcePool>" (7)
  31. folder: "/<datacenter_name>/vm/<folder_name>/<subfolder_name>"
  32. zone: <default_zone_name>
  33. ingressVIPs:
  34. - 10.0.0.2
  35. vcenters:
  36. - datacenters:
  37. - <datacenter>
  38. password: <password>
  39. port: 443
  40. server: <fully_qualified_domain_name>
  41. user: administrator@vsphere.local
  42. diskType: thin (8)
  43. clusterOSImage: http://mirror.example.com/images/rhcos-47.83.202103221318-0-vmware.x86_64.ova (9)
  44. pullSecret: '{"auths":{"<local_registry>": {"auth": "<credentials>","email": "you@example.com"}}}' (10)
  45. sshKey: 'ssh-ed25519 AAAA...'
  46. additionalTrustBundle: | (11)
  47. -----BEGIN CERTIFICATE-----
  48. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
  49. -----END CERTIFICATE-----
  50. imageContentSources: (12)
  51. - mirrors:
  52. - <mirror_host_name>:<mirror_port>/<repo_name>/release
  53. source: <source_image_1>
  54. - mirrors:
  55. - <mirror_host_name>:<mirror_port>/<repo_name>/release-images
  56. source: <source_image_2>
1The base domain of the cluster. All DNS records must be sub-domains of this base and include the cluster name.
2The controlPlane section is a single mapping, but the compute section is a sequence of mappings. To meet the requirements of the different data structures, the first line of the compute section must begin with a hyphen, -, and the first line of the controlPlane section must not. Only one control plane pool is used.
3The cluster name that you specified in your DNS records.
4Optional: Provides additional configuration for the machine pool parameters for the compute and control plane machines.
5Establishes the relationships between a region and zone. You define a failure domain by using vCenter objects, such as a datastore object. A failure domain defines the vCenter location for OKD cluster nodes.
6The path to the vSphere datastore that holds virtual machine files, templates, and ISO images.

You can specify the path of any datastore that exists in a datastore cluster. By default, Storage vMotion is automatically enabled for a datastore cluster. Red Hat does not support Storage vMotion, so you must disable Storage vMotion to avoid data loss issues for your OKD cluster.

If you must specify VMs across multiple datastores, use a datastore object to specify a failure domain in your cluster’s install-config.yaml configuration file. For more information, see “VMware vSphere region and zone enablement”.

7Optional: Provides an existing resource pool for machine creation. If you do not specify a value, the installation program uses the root resource pool of the vSphere cluster.
8The vSphere disk provisioning method.
9The location of the Fedora CoreOS (FCOS) image that is accessible from the bastion server.
10For <local_registry>, specify the registry domain name, and optionally the port, that your mirror registry uses to serve content. For example registry.example.com or registry.example.com:5000. For <credentials>, specify the base64-encoded user name and password for your mirror registry.
11Provide the contents of the certificate file that you used for your mirror registry.
12Provide the imageContentSources section from the output of the command to mirror the repository.

In OKD 4.12 and later, the apiVIP and ingressVIP configuration settings are deprecated. Instead, use a list format to enter values in the apiVIPs and ingressVIPs configuration settings.

Configuring the cluster-wide proxy during installation

Production environments can deny direct access to the internet and instead have an HTTP or HTTPS proxy available. You can configure a new OKD cluster to use a proxy by configuring the proxy settings in the install-config.yaml file.

Prerequisites

  • You have an existing install-config.yaml file.

  • You reviewed the sites that your cluster requires access to and determined whether any of them need to bypass the proxy. By default, all cluster egress traffic is proxied, including calls to hosting cloud provider APIs. You added sites to the Proxy object’s spec.noProxy field to bypass the proxy if necessary.

    The Proxy object status.noProxy field is populated with the values of the networking.machineNetwork[].cidr, networking.clusterNetwork[].cidr, and networking.serviceNetwork[] fields from your installation configuration.

    For installations on Amazon Web Services (AWS), Google Cloud Platform (GCP), Microsoft Azure, and OpenStack, the Proxy object status.noProxy field is also populated with the instance metadata endpoint (169.254.169.254).

Procedure

  1. Edit your install-config.yaml file and add the proxy settings. For example:

    1. apiVersion: v1
    2. baseDomain: my.domain.com
    3. proxy:
    4. httpProxy: http://<username>:<pswd>@<ip>:<port> (1)
    5. httpsProxy: https://<username>:<pswd>@<ip>:<port> (2)
    6. noProxy: example.com (3)
    7. additionalTrustBundle: | (4)
    8. -----BEGIN CERTIFICATE-----
    9. <MY_TRUSTED_CA_CERT>
    10. -----END CERTIFICATE-----
    11. additionalTrustBundlePolicy: <policy_to_add_additionalTrustBundle> (5)
    1A proxy URL to use for creating HTTP connections outside the cluster. The URL scheme must be http.
    2A proxy URL to use for creating HTTPS connections outside the cluster.
    3A comma-separated list of destination domain names, IP addresses, or other network CIDRs to exclude from proxying. Preface a domain with . to match subdomains only. For example, .y.com matches x.y.com, but not y.com. Use * to bypass the proxy for all destinations. You must include vCenter’s IP address and the IP range that you use for its machines.
    4If provided, the installation program generates a config map that is named user-ca-bundle in the openshift-config namespace to hold the additional CA certificates. If you provide additionalTrustBundle and at least one proxy setting, the Proxy object is configured to reference the user-ca-bundle config map in the trustedCA field. The Cluster Network Operator then creates a trusted-ca-bundle config map that merges the contents specified for the trustedCA parameter with the FCOS trust bundle. The additionalTrustBundle field is required unless the proxy’s identity certificate is signed by an authority from the FCOS trust bundle.
    5Optional: The policy to determine the configuration of the Proxy object to reference the user-ca-bundle config map in the trustedCA field. The allowed values are Proxyonly and Always. Use Proxyonly to reference the user-ca-bundle config map only when http/https proxy is configured. Use Always to always reference the user-ca-bundle config map. The default value is Proxyonly.

    The installation program does not support the proxy readinessEndpoints field.

    If the installer times out, restart and then complete the deployment by using the wait-for command of the installer. For example:

    1. $ ./openshift-install wait-for install-complete log-level debug
  2. Save the file and reference it when installing OKD.

The installation program creates a cluster-wide proxy that is named cluster that uses the proxy settings in the provided install-config.yaml file. If no proxy settings are provided, a cluster Proxy object is still created, but it will have a nil spec.

Only the Proxy object named cluster is supported, and no additional proxies can be created.

Configuring regions and zones for a VMware vCenter

You can modify the default installation configuration file, so that you can deploy an OKD cluster to multiple vSphere datacenters that run in a single VMware vCenter.

The default install-config.yaml file configuration from the previous release of OKD is deprecated. You can continue to use the deprecated default configuration, but the openshift-installer will prompt you with a warning message that indicates the use of deprecated fields in the configuration file.

The example uses the govc command. The govc command is an open source command available from VMware; it is not available from Red Hat. The Red Hat support team does not maintain the govc command. Instructions for downloading and installing govc are found on the VMware documentation website

Prerequisites

  • You have an existing install-config.yaml installation configuration file.

    You must specify at least one failure domain for your OKD cluster, so that you can provision datacenter objects for your VMware vCenter server. Consider specifying multiple failure domains if you need to provision virtual machine nodes in different datacenters, clusters, datastores, and other components.

Procedure

  1. Enter the following govc command-line tool commands to create the openshift-region and openshift-zone vCenter tag categories:

    If you specify different names for the openshift-region and openshift-zone vCenter tag categories, the installation of the OKD cluster fails.

    1. $ govc tags.category.create -d "OpenShift region" openshift-region
    1. $ govc tags.category.create -d "OpenShift zone" openshift-zone
  2. To create a region tag for each region vSphere datacenter where you want to deploy your cluster, enter the following command in your terminal:

    1. $ govc tags.create -c <region_tag_category> <region_tag>
  3. To create a zone tag for each vSphere cluster where you want to deploy your cluster, enter the following command:

    1. $ govc tags.create -c <zone_tag_category> <zone_tag>
  4. Attach region tags to each vCenter datacenter object by entering the following command:

    1. $ govc tags.attach -c <region_tag_category> <region_tag_1> /<datacenter_1>
  5. Attach the zone tags to each vCenter datacenter object by entering the following command:

    1. $ govc tags.attach -c <zone_tag_category> <zone_tag_1> /<datacenter_1>/host/vcs-mdcnc-workload-1
  6. Change to the directory that contains the installation program and initialize the cluster deployment according to your chosen installation requirements.

Sample install-config.yaml file with multiple datacenters defined in a vSphere center

  1. ---
  2. compute:
  3. ---
  4. vsphere:
  5. zones:
  6. - "<machine_pool_zone_1>"
  7. - "<machine_pool_zone_2>"
  8. ---
  9. controlPlane:
  10. ---
  11. vsphere:
  12. zones:
  13. - "<machine_pool_zone_1>"
  14. - "<machine_pool_zone_2>"
  15. ---
  16. platform:
  17. vsphere:
  18. vcenters:
  19. ---
  20. datacenters:
  21. - <datacenter1_name>
  22. - <datacenter2_name>
  23. failureDomains:
  24. - name: <machine_pool_zone_1>
  25. region: <region_tag_1>
  26. zone: <zone_tag_1>
  27. server: <fully_qualified_domain_name>
  28. topology:
  29. datacenter: <datacenter1>
  30. computeCluster: "/<datacenter1>/host/<cluster1>"
  31. networks:
  32. - <VM_Network1_name>
  33. datastore: "/<datacenter1>/datastore/<datastore1>"
  34. resourcePool: "/<datacenter1>/host/<cluster1>/Resources/<resourcePool1>"
  35. folder: "/<datacenter1>/vm/<folder1>"
  36. - name: <machine_pool_zone_2>
  37. region: <region_tag_2>
  38. zone: <zone_tag_2>
  39. server: <fully_qualified_domain_name>
  40. topology:
  41. datacenter: <datacenter2>
  42. computeCluster: "/<datacenter2>/host/<cluster2>"
  43. networks:
  44. - <VM_Network2_name>
  45. datastore: "/<datacenter2>/datastore/<datastore2>"
  46. resourcePool: "/<datacenter2>/host/<cluster2>/Resources/<resourcePool2>"
  47. folder: "/<datacenter2>/vm/<folder2>"
  48. ---

Deploying the cluster

You can install OKD on a compatible cloud platform.

You can run the create cluster command of the installation program only once, during initial installation.

Prerequisites

  • You have the OKD installation program and the pull secret for your cluster.

  • You have verified that the cloud provider account on your host has the correct permissions to deploy the cluster. An account with incorrect permissions causes the installation process to fail with an error message that displays the missing permissions.

  • Optional: Before you create the cluster, configure an external load balancer in place of the default load balancer.

    You do not need to specify API and Ingress static addresses for your installation program. If you choose this configuration, you must take additional actions to define network targets that accept an IP address from each referenced vSphere subnet. See the section “Configuring an external load balancer”.

Procedure

  • Change to the directory that contains the installation program and initialize the cluster deployment:

    1. $ ./openshift-install create cluster --dir <installation_directory> \ (1)
    2. --log-level=info (2)
    1For <installation_directory>, specify the location of your customized ./install-config.yaml file.
    2To view different installation details, specify warn, debug, or error instead of info.

Verification

When the cluster deployment completes successfully:

  • The terminal displays directions for accessing your cluster, including a link to the web console and credentials for the kubeadmin user.

  • Credential information also outputs to <installation_directory>/.openshift_install.log.

Do not delete the installation program or the files that the installation program creates. Both are required to delete the cluster.

Example output

  1. ...
  2. INFO Install complete!
  3. INFO To access the cluster as the system:admin user when using 'oc', run 'export KUBECONFIG=/home/myuser/install_dir/auth/kubeconfig'
  4. INFO Access the OpenShift web-console here: https://console-openshift-console.apps.mycluster.example.com
  5. INFO Login to the console with user: "kubeadmin", and password: "password"
  6. INFO Time elapsed: 36m22s
  • The Ignition config files that the installation program generates contain certificates that expire after 24 hours, which are then renewed at that time. If the cluster is shut down before renewing the certificates and the cluster is later restarted after the 24 hours have elapsed, the cluster automatically recovers the expired certificates. The exception is that you must manually approve the pending node-bootstrapper certificate signing requests (CSRs) to recover kubelet certificates. See the documentation for Recovering from expired control plane certificates for more information.

  • It is recommended that you use Ignition config files within 12 hours after they are generated because the 24-hour certificate rotates from 16 to 22 hours after the cluster is installed. By using the Ignition config files within 12 hours, you can avoid installation failure if the certificate update runs during installation.

Installing the OpenShift CLI by downloading the binary

You can install the OpenShift CLI (oc) to interact with OKD from a command-line interface. You can install oc on Linux, Windows, or macOS.

If you installed an earlier version of oc, you cannot use it to complete all of the commands in OKD 4. Download and install the new version of oc.

Installing the OpenShift CLI on Linux

You can install the OpenShift CLI (oc) binary on Linux by using the following procedure.

Procedure

  1. Navigate to https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/ and choose the folder for your operating system and architecture.

  2. Download oc.tar.gz.

  3. Unpack the archive:

    1. $ tar xvf <file>
  4. Place the oc binary in a directory that is on your PATH.

    To check your PATH, execute the following command:

    1. $ echo $PATH

Verification

  • After you install the OpenShift CLI, it is available using the oc command:

    1. $ oc <command>

Installing the OpenShift CLI on Windows

You can install the OpenShift CLI (oc) binary on Windows by using the following procedure.

Procedure

  1. Navigate to https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/ and choose the folder for your operating system and architecture.

  2. Download oc.zip.

  3. Unzip the archive with a ZIP program.

  4. Move the oc binary to a directory that is on your PATH.

    To check your PATH, open the command prompt and execute the following command:

    1. C:\> path

Verification

  • After you install the OpenShift CLI, it is available using the oc command:

    1. C:\> oc <command>

Installing the OpenShift CLI on macOS

You can install the OpenShift CLI (oc) binary on macOS by using the following procedure.

Procedure

  1. Navigate to https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/ and choose the folder for your operating system and architecture.

  2. Download oc.tar.gz.

  3. Unpack and unzip the archive.

  4. Move the oc binary to a directory on your PATH.

    To check your PATH, open a terminal and execute the following command:

    1. $ echo $PATH

Verification

  • After you install the OpenShift CLI, it is available using the oc command:

    1. $ oc <command>

Logging in to the cluster by using the CLI

You can log in to your cluster as a default system user by exporting the cluster kubeconfig file. The kubeconfig file contains information about the cluster that is used by the CLI to connect a client to the correct cluster and API server. The file is specific to a cluster and is created during OKD installation.

Prerequisites

  • You deployed an OKD cluster.

  • You installed the oc CLI.

Procedure

  1. Export the kubeadmin credentials:

    1. $ export KUBECONFIG=<installation_directory>/auth/kubeconfig (1)
    1For <installation_directory>, specify the path to the directory that you stored the installation files in.
  2. Verify you can run oc commands successfully using the exported configuration:

    1. $ oc whoami

    Example output

    1. system:admin

Disabling the default OperatorHub catalog sources

Operator catalogs that source content provided by Red Hat and community projects are configured for OperatorHub by default during an OKD installation. In a restricted network environment, you must disable the default catalogs as a cluster administrator.

Procedure

  • Disable the sources for the default catalogs by adding disableAllDefaultSources: true to the OperatorHub object:

    1. $ oc patch OperatorHub cluster --type json \
    2. -p '[{"op": "add", "path": "/spec/disableAllDefaultSources", "value": true}]'

Alternatively, you can use the web console to manage catalog sources. From the AdministrationCluster SettingsConfigurationOperatorHub page, click the Sources tab, where you can create, update, delete, disable, and enable individual sources.

Creating registry storage

After you install the cluster, you must create storage for the Registry Operator.

Image registry removed during installation

On platforms that do not provide shareable object storage, the OpenShift Image Registry Operator bootstraps itself as Removed. This allows openshift-installer to complete installations on these platform types.

After installation, you must edit the Image Registry Operator configuration to switch the managementState from Removed to Managed.

Image registry storage configuration

The Image Registry Operator is not initially available for platforms that do not provide default storage. After installation, you must configure your registry to use storage so that the Registry Operator is made available.

Instructions are shown for configuring a persistent volume, which is required for production clusters. Where applicable, instructions are shown for configuring an empty directory as the storage location, which is available for only non-production clusters.

Additional instructions are provided for allowing the image registry to use block storage types by using the Recreate rollout strategy during upgrades.

Configuring registry storage for VMware vSphere

As a cluster administrator, following installation you must configure your registry to use storage.

Prerequisites

  • Cluster administrator permissions.

  • A cluster on VMware vSphere.

  • Persistent storage provisioned for your cluster, such as Red Hat OpenShift Data Foundation.

    OKD supports ReadWriteOnce access for image registry storage when you have only one replica. ReadWriteOnce access also requires that the registry uses the Recreate rollout strategy. To deploy an image registry that supports high availability with two or more replicas, ReadWriteMany access is required.

  • Must have “100Gi” capacity.

Testing shows issues with using the NFS server on RHEL as storage backend for core services. This includes the OpenShift Container Registry and Quay, Prometheus for monitoring storage, and Elasticsearch for logging storage. Therefore, using RHEL NFS to back PVs used by core services is not recommended.

Other NFS implementations on the marketplace might not have these issues. Contact the individual NFS implementation vendor for more information on any testing that was possibly completed against these OKD core components.

Procedure

  1. To configure your registry to use storage, change the spec.storage.pvc in the configs.imageregistry/cluster resource.

    When you use shared storage, review your security settings to prevent outside access.

  2. Verify that you do not have a registry pod:

    1. $ oc get pod -n openshift-image-registry -l docker-registry=default

    Example output

    1. No resourses found in openshift-image-registry namespace

    If you do have a registry pod in your output, you do not need to continue with this procedure.

  3. Check the registry configuration:

    1. $ oc edit configs.imageregistry.operator.openshift.io

    Example output

    1. storage:
    2. pvc:
    3. claim: (1)
    1Leave the claim field blank to allow the automatic creation of an image-registry-storage persistent volume claim (PVC). The PVC is generated based on the default storage class. However, be aware that the default storage class might provide ReadWriteOnce (RWO) volumes, such as a RADOS Block Device (RBD), which can cause issues when you replicate to more than one replica.
  4. Check the clusteroperator status:

    1. $ oc get clusteroperator image-registry

    Example output

    1. NAME VERSION AVAILABLE PROGRESSING DEGRADED SINCE MESSAGE
    2. image-registry 4.7 True False False 6h50m

Additional resources

Configuring an external load balancer

You can configure an OKD cluster to use an external load balancer in place of the default load balancer.

Configuring an external load balancer depends on your vendor’s load balancer.

The information and examples in this section are for guideline purposes only. Consult the vendor documentation for more specific information about the vendor’s load balancer.

Red Hat supports the following services for an external load balancer:

  • Ingress Controller

  • OpenShift API

  • OpenShift MachineConfig API

You can choose whether you want to configure one or all of these services for an external load balancer. Configuring only the Ingress Controller service is a common configuration option. To better understand each service, view the following diagrams:

An image that shows an example network workflow of an Ingress Controller operating in an OKD environment.

Figure 1. Example network workflow that shows an Ingress Controller operating in an OKD environment

An image that shows an example network workflow of an OpenShift API operating in an OKD environment.

Figure 2. Example network workflow that shows an OpenShift API operating in an OKD environment

An image that shows an example network workflow of an OpenShift MachineConfig API operating in an OKD environment.

Figure 3. Example network workflow that shows an OpenShift MachineConfig API operating in an OKD environment

The following configuration options are supported for external load balancers:

  • Use a node selector to map the Ingress Controller to a specific set of nodes. You must assign a static IP address to each node in this set, or configure each node to receive the same IP address from the Dynamic Host Configuration Protocol (DHCP). Infrastructure nodes commonly receive this type of configuration.

  • Target all IP addresses on a subnet. This configuration can reduce maintenance overhead, because you can create and destroy nodes within those networks without reconfiguring the load balancer targets. If you deploy your ingress pods by using a machine set on a smaller network, such as a /27 or /28, you can simplify your load balancer targets.

    You can list all IP addresses that exist in a network by checking the machine config pool’s resources.

Considerations

  • For a front-end IP address, you can use the same IP address for the front-end IP address, the Ingress Controller’s load balancer, and API load balancer. Check the vendor’s documentation for this capability.

  • For a back-end IP address, ensure that an IP address for an OKD control plane node does not change during the lifetime of the external load balancer. You can achieve this by completing one of the following actions:

    • Assign a static IP address to each control plane node.

    • Configure each node to receive the same IP address from the DHCP every time the node requests a DHCP lease. Depending on the vendor, the DHCP lease might be in the form of an IP reservation or a static DHCP assignment.

  • Manually define each node that runs the Ingress Controller in the external load balancer for the Ingress Controller back-end service. For example, if the Ingress Controller moves to an undefined node, a connection outage can occur.

OpenShift API prerequisites

  • You defined a front-end IP address.

  • TCP ports 6443 and 22623 are exposed on the front-end IP address of your load balancer. Check the following items:

    • Port 6443 provides access to the OpenShift API service.

    • Port 22623 can provide ignition startup configurations to nodes.

  • The front-end IP address and port 6443 are reachable by all users of your system with a location external to your OKD cluster.

  • The front-end IP address and port 22623 are reachable only by OKD nodes.

  • The load balancer backend can communicate with OKD control plane nodes on port 6443 and 22623.

Ingress Controller prerequisites

  • You defined a front-end IP address.

  • TCP ports 443 and 80 are exposed on the front-end IP address of your load balancer.

  • The front-end IP address, port 80 and port 443 are be reachable by all users of your system with a location external to your OKD cluster.

  • The front-end IP address, port 80 and port 443 are reachable to all nodes that operate in your OKD cluster.

  • The load balancer backend can communicate with OKD nodes that run the Ingress Controller on ports 80, 443, and 1936.

Prerequisite for health check URL specifications

You can configure most load balancers by setting health check URLs that determine if a service is available or unavailable. OKD provides these health checks for the OpenShift API, Machine Configuration API, and Ingress Controller backend services.

The following examples demonstrate health check specifications for the previously listed backend services:

Example of a Kubernetes API health check specification

  1. Path: HTTPS:6443/readyz
  2. Healthy threshold: 2
  3. Unhealthy threshold: 2
  4. Timeout: 10
  5. Interval: 10

Example of a Machine Config API health check specification

  1. Path: HTTPS:22623/healthz
  2. Healthy threshold: 2
  3. Unhealthy threshold: 2
  4. Timeout: 10
  5. Interval: 10

Example of an Ingress Controller health check specification

  1. Path: HTTP:1936/healthz/ready
  2. Healthy threshold: 2
  3. Unhealthy threshold: 2
  4. Timeout: 5
  5. Interval: 10

Procedure

  1. Configure the HAProxy Ingress Controller, so that you can enable access to the cluster from your load balancer on ports 6443, 443, and 80:

    Example HAProxy configuration

    1. #...
    2. listen my-cluster-api-6443
    3. bind 192.168.1.100:6443
    4. mode tcp
    5. balance roundrobin
    6. option httpchk
    7. http-check connect
    8. http-check send meth GET uri /readyz
    9. http-check expect status 200
    10. server my-cluster-master-2 192.168.1.101:6443 check inter 10s rise 2 fall 2
    11. server my-cluster-master-0 192.168.1.102:6443 check inter 10s rise 2 fall 2
    12. server my-cluster-master-1 192.168.1.103:6443 check inter 10s rise 2 fall 2
    13. listen my-cluster-machine-config-api-22623
    14. bind 192.168.1.1000.0.0.0:22623
    15. mode tcp
    16. balance roundrobin
    17. option httpchk
    18. http-check connect
    19. http-check send meth GET uri /healthz
    20. http-check expect status 200
    21. server my-cluster-master-2 192.0168.21.2101:22623 check inter 10s rise 2 fall 2
    22. server my-cluster-master-0 192.168.1.1020.2.3:22623 check inter 10s rise 2 fall 2
    23. server my-cluster-master-1 192.168.1.1030.2.1:22623 check inter 10s rise 2 fall 2
    24. listen my-cluster-apps-443
    25. bind 192.168.1.100:443
    26. mode tcp
    27. balance roundrobin
    28. option httpchk
    29. http-check connect
    30. http-check send meth GET uri /healthz/ready
    31. http-check expect status 200
    32. server my-cluster-worker-0 192.168.1.111:443 check port 1936 inter 10s rise 2 fall 2
    33. server my-cluster-worker-1 192.168.1.112:443 check port 1936 inter 10s rise 2 fall 2
    34. server my-cluster-worker-2 192.168.1.113:443 check port 1936 inter 10s rise 2 fall 2
    35. listen my-cluster-apps-80
    36. bind 192.168.1.100:80
    37. mode tcp
    38. balance roundrobin
    39. option httpchk
    40. http-check connect
    41. http-check send meth GET uri /healthz/ready
    42. http-check expect status 200
    43. server my-cluster-worker-0 192.168.1.111:80 check port 1936 inter 10s rise 2 fall 2
    44. server my-cluster-worker-1 192.168.1.112:80 check port 1936 inter 10s rise 2 fall 2
    45. server my-cluster-worker-2 192.168.1.113:80 check port 1936 inter 10s rise 2 fall 2
    46. # ...
  2. Use the curl CLI command to verify that the external load balancer and its resources are operational:

    1. Verify that the cluster machine configuration API is accessible to the Kubernetes API server resource, by running the following command and observing the response:

      1. $ curl https://<loadbalancer_ip_address>:6443/version --insecure

      If the configuration is correct, you receive a JSON object in response:

      1. {
      2. "major": "1",
      3. "minor": "11+",
      4. "gitVersion": "v1.11.0+ad103ed",
      5. "gitCommit": "ad103ed",
      6. "gitTreeState": "clean",
      7. "buildDate": "2019-01-09T06:44:10Z",
      8. "goVersion": "go1.10.3",
      9. "compiler": "gc",
      10. "platform": "linux/amd64"
      11. }
    2. Verify that the cluster machine configuration API is accessible to the Machine config server resource, by running the following command and observing the output:

      1. $ curl -v https://<loadbalancer_ip_address>:22623/healthz --insecure

      If the configuration is correct, the output from the command shows the following response:

      1. HTTP/1.1 200 OK
      2. Content-Length: 0
    3. Verify that the controller is accessible to the Ingress Controller resource on port 80, by running the following command and observing the output:

      1. $ curl -I -L -H "Host: console-openshift-console.apps.<cluster_name>.<base_domain>" http://<load_balancer_front_end_IP_address>

      If the configuration is correct, the output from the command shows the following response:

      1. HTTP/1.1 302 Found
      2. content-length: 0
      3. location: https://console-openshift-console.apps.ocp4.private.opequon.net/
      4. cache-control: no-cache
    4. Verify that the controller is accessible to the Ingress Controller resource on port 443, by running the following command and observing the output:

      1. $ curl -I -L --insecure --resolve console-openshift-console.apps.<cluster_name>.<base_domain>:443:<Load Balancer Front End IP Address> https://console-openshift-console.apps.<cluster_name>.<base_domain>

      If the configuration is correct, the output from the command shows the following response:

      1. HTTP/1.1 200 OK
      2. referrer-policy: strict-origin-when-cross-origin
      3. set-cookie: csrf-token=UlYWOyQ62LWjw2h003xtYSKlh1a0Py2hhctw0WmV2YEdhJjFyQwWcGBsja261dGLgaYO0nxzVErhiXt6QepA7g==; Path=/; Secure; SameSite=Lax
      4. x-content-type-options: nosniff
      5. x-dns-prefetch-control: off
      6. x-frame-options: DENY
      7. x-xss-protection: 1; mode=block
      8. date: Wed, 04 Oct 2023 16:29:38 GMT
      9. content-type: text/html; charset=utf-8
      10. set-cookie: 1e2670d92730b515ce3a1bb65da45062=1bf5e9573c9a2760c964ed1659cc1673; path=/; HttpOnly; Secure; SameSite=None
      11. cache-control: private
  3. Configure the DNS records for your cluster to target the front-end IP addresses of the external load balancer. You must update records to your DNS server for the cluster API and applications over the load balancer.

    Examples of modified DNS records

    1. <load_balancer_ip_address> A api.<cluster_name>.<base_domain>
    2. A record pointing to Load Balancer Front End
    1. <load_balancer_ip_address> A apps.<cluster_name>.<base_domain>
    2. A record pointing to Load Balancer Front End

    DNS propagation might take some time for each DNS record to become available. Ensure that each DNS record propagates before validating each record.

  4. Use the curl CLI command to verify that the external load balancer and DNS record configuration are operational:

    1. Verify that you can access the cluster API, by running the following command and observing the output:

      1. $ curl https://api.<cluster_name>.<base_domain>:6443/version --insecure

      If the configuration is correct, you receive a JSON object in response:

      1. {
      2. "major": "1",
      3. "minor": "11+",
      4. "gitVersion": "v1.11.0+ad103ed",
      5. "gitCommit": "ad103ed",
      6. "gitTreeState": "clean",
      7. "buildDate": "2019-01-09T06:44:10Z",
      8. "goVersion": "go1.10.3",
      9. "compiler": "gc",
      10. "platform": "linux/amd64"
      11. }
    2. Verify that you can access the cluster machine configuration, by running the following command and observing the output:

      1. $ curl -v https://api.<cluster_name>.<base_domain>:22623/healthz --insecure

      If the configuration is correct, the output from the command shows the following response:

      1. HTTP/1.1 200 OK
      2. Content-Length: 0
    3. Verify that you can access each cluster application on port, by running the following command and observing the output:

      1. $ curl http://console-openshift-console.apps.<cluster_name>.<base_domain> -I -L --insecure

      If the configuration is correct, the output from the command shows the following response:

      1. HTTP/1.1 302 Found
      2. content-length: 0
      3. location: https://console-openshift-console.apps.<cluster-name>.<base domain>/
      4. cache-control: no-cacheHTTP/1.1 200 OK
      5. referrer-policy: strict-origin-when-cross-origin
      6. set-cookie: csrf-token=39HoZgztDnzjJkq/JuLJMeoKNXlfiVv2YgZc09c3TBOBU4NI6kDXaJH1LdicNhN1UsQWzon4Dor9GWGfopaTEQ==; Path=/; Secure
      7. x-content-type-options: nosniff
      8. x-dns-prefetch-control: off
      9. x-frame-options: DENY
      10. x-xss-protection: 1; mode=block
      11. date: Tue, 17 Nov 2020 08:42:10 GMT
      12. content-type: text/html; charset=utf-8
      13. set-cookie: 1e2670d92730b515ce3a1bb65da45062=9b714eb87e93cf34853e87a92d6894be; path=/; HttpOnly; Secure; SameSite=None
      14. cache-control: private
    4. Verify that you can access each cluster application on port 443, by running the following command and observing the output:

      1. $ curl https://console-openshift-console.apps.<cluster_name>.<base_domain> -I -L --insecure

      If the configuration is correct, the output from the command shows the following response:

      1. HTTP/1.1 200 OK
      2. referrer-policy: strict-origin-when-cross-origin
      3. set-cookie: csrf-token=UlYWOyQ62LWjw2h003xtYSKlh1a0Py2hhctw0WmV2YEdhJjFyQwWcGBsja261dGLgaYO0nxzVErhiXt6QepA7g==; Path=/; Secure; SameSite=Lax
      4. x-content-type-options: nosniff
      5. x-dns-prefetch-control: off
      6. x-frame-options: DENY
      7. x-xss-protection: 1; mode=block
      8. date: Wed, 04 Oct 2023 16:29:38 GMT
      9. content-type: text/html; charset=utf-8
      10. set-cookie: 1e2670d92730b515ce3a1bb65da45062=1bf5e9573c9a2760c964ed1659cc1673; path=/; HttpOnly; Secure; SameSite=None
      11. cache-control: private

Next steps