Installing a cluster into a shared VPC on GCP using Deployment Manager templates

In OKD version 4.13, you can install a cluster into a shared Virtual Private Cloud (VPC) on Google Cloud Platform (GCP) that uses infrastructure that you provide. In this context, a cluster installed into a shared VPC is a cluster that is configured to use a VPC from a project different from where the cluster is being deployed.

A shared VPC enables an organization to connect resources from multiple projects to a common VPC network. You can communicate within the organization securely and efficiently by using internal IPs from that network. For more information about shared VPC, see Shared VPC overview in the GCP documentation.

The steps for performing a user-provided infrastructure installation into a shared VPC are outlined here. Several Deployment Manager templates are provided to assist in completing these steps or to help model your own. You are also free to create the required resources through other methods.

The steps for performing a user-provisioned infrastructure installation are provided as an example only. Installing a cluster with infrastructure you provide requires knowledge of the cloud provider and the installation process of OKD. Several Deployment Manager templates are provided to assist in completing these steps or to help model your own. You are also free to create the required resources through other methods; the templates are just an example.

Prerequisites

Certificate signing requests management

Because your cluster has limited access to automatic machine management when you use infrastructure that you provision, you must provide a mechanism for approving cluster certificate signing requests (CSRs) after installation. The kube-controller-manager only approves the kubelet client CSRs. The machine-approver cannot guarantee the validity of a serving certificate that is requested by using kubelet credentials because it cannot confirm that the correct machine issued the request. You must determine and implement a method of verifying the validity of the kubelet serving certificate requests and approving them.

Configuring the GCP project that hosts your cluster

Before you can install OKD, you must configure a Google Cloud Platform (GCP) project to host it.

Creating a GCP project

To install OKD, you must create a project in your Google Cloud Platform (GCP) account to host the cluster.

Procedure

  • Create a project to host your OKD cluster. See Creating and Managing Projects in the GCP documentation.

    Your GCP project must use the Premium Network Service Tier if you are using installer-provisioned infrastructure. The Standard Network Service Tier is not supported for clusters installed using the installation program. The installation program configures internal load balancing for the api-int.<cluster_name>.<base_domain> URL; the Premium Tier is required for internal load balancing.

Enabling API services in GCP

Your Google Cloud Platform (GCP) project requires access to several API services to complete OKD installation.

Prerequisites

  • You created a project to host your cluster.

Procedure

  • Enable the following required API services in the project that hosts your cluster. You may also enable optional API services which are not required for installation. See Enabling services in the GCP documentation.

    Table 1. Required API services
    API serviceConsole service name

    Compute Engine API

    compute.googleapis.com

    Cloud Resource Manager API

    cloudresourcemanager.googleapis.com

    Google DNS API

    dns.googleapis.com

    IAM Service Account Credentials API

    iamcredentials.googleapis.com

    Identity and Access Management (IAM) API

    iam.googleapis.com

    Service Usage API

    serviceusage.googleapis.com

    Table 2. Optional API services
    API serviceConsole service name

    Cloud Deployment Manager V2 API

    deploymentmanager.googleapis.com

    Google Cloud APIs

    cloudapis.googleapis.com

    Service Management API

    servicemanagement.googleapis.com

    Google Cloud Storage JSON API

    storage-api.googleapis.com

    Cloud Storage

    storage-component.googleapis.com

GCP account limits

The OKD cluster uses a number of Google Cloud Platform (GCP) components, but the default Quotas do not affect your ability to install a default OKD cluster.

A default cluster, which contains three compute and three control plane machines, uses the following resources. Note that some resources are required only during the bootstrap process and are removed after the cluster deploys.

Table 3. GCP resources used in a default cluster
ServiceComponentLocationTotal resources requiredResources removed after bootstrap

Service account

IAM

Global

6

1

Firewall rules

Networking

Global

11

1

Forwarding rules

Compute

Global

2

0

Health checks

Compute

Global

2

0

Images

Compute

Global

1

0

Networks

Networking

Global

1

0

Routers

Networking

Global

1

0

Routes

Networking

Global

2

0

Subnetworks

Compute

Global

2

0

Target pools

Networking

Global

2

0

If any of the quotas are insufficient during installation, the installation program displays an error that states both which quota was exceeded and the region.

Be sure to consider your actual cluster size, planned cluster growth, and any usage from other clusters that are associated with your account. The CPU, static IP addresses, and persistent disk SSD (storage) quotas are the ones that are most likely to be insufficient.

If you plan to deploy your cluster in one of the following regions, you will exceed the maximum storage quota and are likely to exceed the CPU quota limit:

  • asia-east2

  • asia-northeast2

  • asia-south1

  • australia-southeast1

  • europe-north1

  • europe-west2

  • europe-west3

  • europe-west6

  • northamerica-northeast1

  • southamerica-east1

  • us-west2

You can increase resource quotas from the GCP console, but you might need to file a support ticket. Be sure to plan your cluster size early so that you can allow time to resolve the support ticket before you install your OKD cluster.

Creating a service account in GCP

OKD requires a Google Cloud Platform (GCP) service account that provides authentication and authorization to access data in the Google APIs. If you do not have an existing IAM service account that contains the required roles in your project, you must create one.

Prerequisites

  • You created a project to host your cluster.

Procedure

  1. Create a service account in the project that you use to host your OKD cluster. See Creating a service account in the GCP documentation.

  2. Grant the service account the appropriate permissions. You can either grant the individual permissions that follow or assign the Owner role to it. See Granting roles to a service account for specific resources.

    While making the service account an owner of the project is the easiest way to gain the required permissions, it means that service account has complete control over the project. You must determine if the risk that comes from offering that power is acceptable.

  3. You can create the service account key in JSON format, or attach the service account to a GCP virtual machine. See Creating service account keys and Creating and enabling service accounts for instances in the GCP documentation.

    You must have a service account key or a virtual machine with an attached service account to create the cluster.

    If you use a virtual machine with an attached service account to create your cluster, you must set credentialsMode: Manual in the install-config.yaml file before installation.

Required GCP roles

When you attach the Owner role to the service account that you create, you grant that service account all permissions, including those that are required to install OKD. If your organization’s security policies require a more restrictive set of permissions, you can create a service account with the following permissions. If you deploy your cluster into an existing virtual private cloud (VPC), the service account does not require certain networking permissions, which are noted in the following lists:

Required roles for the installation program

  • Compute Admin

  • IAM Security Admin

  • Service Account Admin

  • Service Account Key Admin

  • Service Account User

  • Storage Admin

Required roles for creating network resources during installation

  • DNS Administrator

Required roles for using passthrough credentials mode

  • Compute Load Balancer Admin

  • IAM Role Viewer

Required roles for user-provisioned GCP infrastructure

  • Deployment Manager Editor

The roles are applied to the service accounts that the control plane and compute machines use:

Table 4. GCP service account permissions
AccountRoles

Control Plane

roles/compute.instanceAdmin

roles/compute.networkAdmin

roles/compute.securityAdmin

roles/storage.admin

roles/iam.serviceAccountUser

Compute

roles/compute.viewer

roles/storage.admin

Supported GCP regions

You can deploy an OKD cluster to the following Google Cloud Platform (GCP) regions:

  • asia-east1 (Changhua County, Taiwan)

  • asia-east2 (Hong Kong)

  • asia-northeast1 (Tokyo, Japan)

  • asia-northeast2 (Osaka, Japan)

  • asia-northeast3 (Seoul, South Korea)

  • asia-south1 (Mumbai, India)

  • asia-south2 (Delhi, India)

  • asia-southeast1 (Jurong West, Singapore)

  • asia-southeast2 (Jakarta, Indonesia)

  • australia-southeast1 (Sydney, Australia)

  • australia-southeast2 (Melbourne, Australia)

  • europe-central2 (Warsaw, Poland)

  • europe-north1 (Hamina, Finland)

  • europe-southwest1 (Madrid, Spain)

  • europe-west1 (St. Ghislain, Belgium)

  • europe-west2 (London, England, UK)

  • europe-west3 (Frankfurt, Germany)

  • europe-west4 (Eemshaven, Netherlands)

  • europe-west6 (Zürich, Switzerland)

  • europe-west8 (Milan, Italy)

  • europe-west9 (Paris, France)

  • europe-west12 (Turin, Italy)

  • me-west1 (Tel Aviv, Israel)

  • northamerica-northeast1 (Montréal, Québec, Canada)

  • northamerica-northeast2 (Toronto, Ontario, Canada)

  • southamerica-east1 (São Paulo, Brazil)

  • southamerica-west1 (Santiago, Chile)

  • us-central1 (Council Bluffs, Iowa, USA)

  • us-east1 (Moncks Corner, South Carolina, USA)

  • us-east4 (Ashburn, Northern Virginia, USA)

  • us-east5 (Columbus, Ohio)

  • us-south1 (Dallas, Texas)

  • us-west1 (The Dalles, Oregon, USA)

  • us-west2 (Los Angeles, California, USA)

  • us-west3 (Salt Lake City, Utah, USA)

  • us-west4 (Las Vegas, Nevada, USA)

Installing and configuring CLI tools for GCP

To install OKD on Google Cloud Platform (GCP) using user-provisioned infrastructure, you must install and configure the CLI tools for GCP.

Prerequisites

  • You created a project to host your cluster.

  • You created a service account and granted it the required permissions.

Procedure

  1. Install the following binaries in $PATH:

    • gcloud

    • gsutil

    See Install the latest Cloud SDK version in the GCP documentation.

  2. Authenticate using the gcloud tool with your configured service account.

    See Authorizing with a service account in the GCP documentation.

Requirements for a cluster with user-provisioned infrastructure

For a cluster that contains user-provisioned infrastructure, you must deploy all of the required machines.

This section describes the requirements for deploying OKD on user-provisioned infrastructure.

Required machines for cluster installation

The smallest OKD clusters require the following hosts:

Table 5. Minimum required hosts
HostsDescription

One temporary bootstrap machine

The cluster requires the bootstrap machine to deploy the OKD cluster on the three control plane machines. You can remove the bootstrap machine after you install the cluster.

Three control plane machines

The control plane machines run the Kubernetes and OKD services that form the control plane.

At least two compute machines, which are also known as worker machines.

The workloads requested by OKD users run on the compute machines.

To maintain high availability of your cluster, use separate physical hosts for these cluster machines.

The bootstrap and control plane machines must use Fedora CoreOS (FCOS) as the operating system. However, the compute machines can choose between Fedora CoreOS (FCOS), Fedora 8.6, Fedora 8.7, or Fedora 8.8.

See Red Hat Enterprise Linux technology capabilities and limits.

Minimum resource requirements for cluster installation

Each cluster machine must meet the following minimum requirements:

Table 6. Minimum resource requirements
MachineOperating SystemvCPU [1]Virtual RAMStorageIOPS [2]

Bootstrap

FCOS

4

16 GB

100 GB

300

Control plane

FCOS

4

16 GB

100 GB

300

Compute

FCOS

2

8 GB

100 GB

300

  1. One vCPU is equivalent to one physical core when simultaneous multithreading (SMT), or hyperthreading, is not enabled. When enabled, use the following formula to calculate the corresponding ratio: (threads per core × cores) × sockets = vCPUs.

  2. OKD and Kubernetes are sensitive to disk performance, and faster storage is recommended, particularly for etcd on the control plane nodes which require a 10 ms p99 fsync duration. Note that on many cloud platforms, storage size and IOPS scale together, so you might need to over-allocate storage volume to obtain sufficient performance.

  3. As with all user-provisioned installations, if you choose to use Fedora compute machines in your cluster, you take responsibility for all operating system life cycle management and maintenance, including performing system updates, applying patches, and completing all other required tasks. Use of Fedora 7 compute machines is deprecated and has been removed in OKD 4.10 and later.

If an instance type for your platform meets the minimum requirements for cluster machines, it is supported to use in OKD.

Tested instance types for GCP

The following Google Cloud Platform instance types have been tested with OKD.

Machine series

  • C2

  • E2

  • M1

  • N1

  • N2

  • N2D

  • Tau T2D

Using custom machine types

Using a custom machine type to install a OKD cluster is supported.

Consider the following when using a custom machine type:

  • Similar to predefined instance types, custom machine types must meet the minimum resource requirements for control plane and compute machines. For more information, see “Minimum resource requirements for cluster installation”.

  • The name of the custom machine type must adhere to the following syntax:

    custom-<number_of_cpus>-<amount_of_memory_in_mb>

    For example, custom-6-20480.

Configuring the GCP project that hosts your shared VPC network

If you use a shared Virtual Private Cloud (VPC) to host your OKD cluster in Google Cloud Platform (GCP), you must configure the project that hosts it.

If you already have a project that hosts the shared VPC network, review this section to ensure that the project meets all of the requirements to install an OKD cluster.

Procedure

  1. Create a project to host the shared VPC for your OKD cluster. See Creating and Managing Projects in the GCP documentation.

  2. Create a service account in the project that hosts your shared VPC. See Creating a service account in the GCP documentation.

  3. Grant the service account the appropriate permissions. You can either grant the individual permissions that follow or assign the Owner role to it. See Granting roles to a service account for specific resources.

    While making the service account an owner of the project is the easiest way to gain the required permissions, it means that service account has complete control over the project. You must determine if the risk that comes from offering that power is acceptable.

    The service account for the project that hosts the shared VPC network requires the following roles:

    • Compute Network User

    • Compute Security Admin

    • Deployment Manager Editor

    • DNS Administrator

    • Security Admin

    • Network Management Admin

Configuring DNS for GCP

To install OKD, the Google Cloud Platform (GCP) account you use must have a dedicated public hosted zone in the project that hosts the shared VPC that you install the cluster into. This zone must be authoritative for the domain. The DNS service provides cluster DNS resolution and name lookup for external connections to the cluster.

Procedure

  1. Identify your domain, or subdomain, and registrar. You can transfer an existing domain and registrar or obtain a new one through GCP or another source.

    If you purchase a new domain, it can take time for the relevant DNS changes to propagate. For more information about purchasing domains through Google, see Google Domains.

  2. Create a public hosted zone for your domain or subdomain in your GCP project. See Creating public zones in the GCP documentation.

    Use an appropriate root domain, such as openshiftcorp.com, or subdomain, such as clusters.openshiftcorp.com.

  3. Extract the new authoritative name servers from the hosted zone records. See Look up your Cloud DNS name servers in the GCP documentation.

    You typically have four name servers.

  4. Update the registrar records for the name servers that your domain uses. For example, if you registered your domain to Google Domains, see the following topic in the Google Domains Help: How to switch to custom name servers.

  5. If you migrated your root domain to Google Cloud DNS, migrate your DNS records. See Migrating to Cloud DNS in the GCP documentation.

  6. If you use a subdomain, follow your company’s procedures to add its delegation records to the parent domain. This process might include a request to your company’s IT department or the division that controls the root domain and DNS services for your company.

Creating a VPC in GCP

You must create a VPC in Google Cloud Platform (GCP) for your OKD cluster to use. You can customize the VPC to meet your requirements. One way to create the VPC is to modify the provided Deployment Manager template.

If you do not use the provided Deployment Manager template to create your GCP infrastructure, you must review the provided information and manually create the infrastructure. If your cluster does not initialize correctly, you might have to contact Red Hat support with your installation logs.

Prerequisites

  • Configure a GCP account.

Procedure

  1. Copy the template from the Deployment Manager template for the VPC section of this topic and save it as 01_vpc.py on your computer. This template describes the VPC that your cluster requires.

  2. Export the following variables required by the resource definition:

    1. Export the control plane CIDR:

      1. $ export MASTER_SUBNET_CIDR='10.0.0.0/17'
    2. Export the compute CIDR:

      1. $ export WORKER_SUBNET_CIDR='10.0.128.0/17'
    3. Export the region to deploy the VPC network and cluster to:

      1. $ export REGION='<region>'
  3. Export the variable for the ID of the project that hosts the shared VPC:

    1. $ export HOST_PROJECT=<host_project>
  4. Export the variable for the email of the service account that belongs to host project:

    1. $ export HOST_PROJECT_ACCOUNT=<host_service_account_email>
  5. Create a 01_vpc.yaml resource definition file:

    1. $ cat <<EOF >01_vpc.yaml
    2. imports:
    3. - path: 01_vpc.py
    4. resources:
    5. - name: cluster-vpc
    6. type: 01_vpc.py
    7. properties:
    8. infra_id: '<prefix>' (1)
    9. region: '${REGION}' (2)
    10. master_subnet_cidr: '${MASTER_SUBNET_CIDR}' (3)
    11. worker_subnet_cidr: '${WORKER_SUBNET_CIDR}' (4)
    12. EOF
    1infra_id is the prefix of the network name.
    2region is the region to deploy the cluster into, for example us-central1.
    3master_subnet_cidr is the CIDR for the master subnet, for example 10.0.0.0/17.
    4worker_subnet_cidr is the CIDR for the worker subnet, for example 10.0.128.0/17.
  6. Create the deployment by using the gcloud CLI:

    1. $ gcloud deployment-manager deployments create <vpc_deployment_name> --config 01_vpc.yaml --project ${HOST_PROJECT} --account ${HOST_PROJECT_ACCOUNT} (1)
    1For <vpc_deployment_name>, specify the name of the VPC to deploy.
  7. Export the VPC variable that other components require:

    1. Export the name of the host project network:

      1. $ export HOST_PROJECT_NETWORK=<vpc_network>
    2. Export the name of the host project control plane subnet:

      1. $ export HOST_PROJECT_CONTROL_SUBNET=<control_plane_subnet>
    3. Export the name of the host project compute subnet:

      1. $ export HOST_PROJECT_COMPUTE_SUBNET=<compute_subnet>
  8. Set up the shared VPC. See Setting up Shared VPC in the GCP documentation.

Deployment Manager template for the VPC

You can use the following Deployment Manager template to deploy the VPC that you need for your OKD cluster:

01_vpc.py Deployment Manager template

  1. def GenerateConfig(context):
  2. resources = [{
  3. 'name': context.properties['infra_id'] + '-network',
  4. 'type': 'compute.v1.network',
  5. 'properties': {
  6. 'region': context.properties['region'],
  7. 'autoCreateSubnetworks': False
  8. }
  9. }, {
  10. 'name': context.properties['infra_id'] + '-master-subnet',
  11. 'type': 'compute.v1.subnetwork',
  12. 'properties': {
  13. 'region': context.properties['region'],
  14. 'network': '$(ref.' + context.properties['infra_id'] + '-network.selfLink)',
  15. 'ipCidrRange': context.properties['master_subnet_cidr']
  16. }
  17. }, {
  18. 'name': context.properties['infra_id'] + '-worker-subnet',
  19. 'type': 'compute.v1.subnetwork',
  20. 'properties': {
  21. 'region': context.properties['region'],
  22. 'network': '$(ref.' + context.properties['infra_id'] + '-network.selfLink)',
  23. 'ipCidrRange': context.properties['worker_subnet_cidr']
  24. }
  25. }, {
  26. 'name': context.properties['infra_id'] + '-router',
  27. 'type': 'compute.v1.router',
  28. 'properties': {
  29. 'region': context.properties['region'],
  30. 'network': '$(ref.' + context.properties['infra_id'] + '-network.selfLink)',
  31. 'nats': [{
  32. 'name': context.properties['infra_id'] + '-nat-master',
  33. 'natIpAllocateOption': 'AUTO_ONLY',
  34. 'minPortsPerVm': 7168,
  35. 'sourceSubnetworkIpRangesToNat': 'LIST_OF_SUBNETWORKS',
  36. 'subnetworks': [{
  37. 'name': '$(ref.' + context.properties['infra_id'] + '-master-subnet.selfLink)',
  38. 'sourceIpRangesToNat': ['ALL_IP_RANGES']
  39. }]
  40. }, {
  41. 'name': context.properties['infra_id'] + '-nat-worker',
  42. 'natIpAllocateOption': 'AUTO_ONLY',
  43. 'minPortsPerVm': 512,
  44. 'sourceSubnetworkIpRangesToNat': 'LIST_OF_SUBNETWORKS',
  45. 'subnetworks': [{
  46. 'name': '$(ref.' + context.properties['infra_id'] + '-worker-subnet.selfLink)',
  47. 'sourceIpRangesToNat': ['ALL_IP_RANGES']
  48. }]
  49. }]
  50. }
  51. }]
  52. return {'resources': resources}

Creating the installation files for GCP

To install OKD on Google Cloud Platform (GCP) using user-provisioned infrastructure, you must generate the files that the installation program needs to deploy your cluster and modify them so that the cluster creates only the machines that it will use. You generate and customize the install-config.yaml file, Kubernetes manifests, and Ignition config files. You also have the option to first set up a separate var partition during the preparation phases of installation.

Manually creating the installation configuration file

For user-provisioned installations of OKD, you manually generate your installation configuration file.

Prerequisites

  • You have an SSH public key on your local machine to provide to the installation program. The key will be used for SSH authentication onto your cluster nodes for debugging and disaster recovery.

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

Procedure

  1. Create an installation directory to store your required installation assets in:

    1. $ mkdir <installation_directory>

    You must create a directory. Some installation assets, like bootstrap X.509 certificates have short expiration intervals, so 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.

  2. Customize the sample install-config.yaml file template that is provided and save it in the <installation_directory>.

    You must name this configuration file install-config.yaml.

    For some platform types, you can alternatively run ./openshift-install create install-config —dir <installation_directory> to generate an install-config.yaml file. You can provide details about your cluster configuration at the prompts.

  3. 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 next step of the installation process. You must back it up now.

Enabling Shielded VMs

You can use Shielded VMs when installing your cluster. Shielded VMs have extra security features including secure boot, firmware and integrity monitoring, and rootkit detection. For more information, see Google’s documentation on Shielded VMs.

Prerequisites

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

Procedure

  • Use a text editor to edit the install-config.yaml file prior to deploying your cluster and add one of the following stanzas:

    1. To use shielded VMs for only control plane machines:

      1. controlPlane:
      2. platform:
      3. gcp:
      4. secureBoot: Enabled
    2. To use shielded VMs for only compute machines:

      1. compute:
      2. - platform:
      3. gcp:
      4. secureBoot: Enabled
    3. To use shielded VMs for all machines:

      1. platform:
      2. gcp:
      3. defaultMachinePlatform:
      4. secureBoot: Enabled

Enabling Confidential VMs

You can use Confidential VMs when installing your cluster. Confidential VMs encrypt data while it is being processed. For more information, see Google’s documentation on Confidential Computing. You can enable Confidential VMs and Shielded VMs at the same time, although they are not dependent on each other.

Confidential Computing is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.

For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.

Prerequisites

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

Procedure

  • Use a text editor to edit the install-config.yaml file prior to deploying your cluster and add one of the following stanzas:

    1. To use confidential VMs for only control plane machines:

      1. controlPlane:
      2. platform:
      3. gcp:
      4. confidentialCompute: Enabled (1)
      5. type: n2d-standard-8 (2)
      6. onHostMaintenance: Terminate (3)
      1Enable confidential VMs.
      2Specify a machine type that supports Confidential VMs. Confidential VMs require the N2D or C2D series of machine types. For more information on supported machine types, see Supported operating systems and machine types.
      3Specify the behavior of the VM during a host maintenance event, such as a hardware or software update. For a machine that uses Confidential VM, this value must be set to Terminate, which stops the VM. Confidential VMs do not support live VM migration.
    2. To use confidential VMs for only compute machines:

      1. compute:
      2. - platform:
      3. gcp:
      4. confidentialCompute: Enabled
      5. type: n2d-standard-8
      6. onHostMaintenance: Terminate
    3. To use confidential VMs for all machines:

      1. platform:
      2. gcp:
      3. defaultMachinePlatform:
      4. confidentialCompute: Enabled
      5. type: n2d-standard-8
      6. onHostMaintenance: Terminate

Sample customized install-config.yaml file for GCP

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.

This sample YAML file is provided for reference only. You must obtain your install-config.yaml file by using the installation program and modify it.

  1. apiVersion: v1
  2. baseDomain: example.com (1)
  3. controlPlane: (2)
  4. hyperthreading: Enabled (3) (4)
  5. name: master
  6. platform:
  7. gcp:
  8. type: n2-standard-4
  9. zones:
  10. - us-central1-a
  11. - us-central1-c
  12. tags: (5)
  13. - control-plane-tag1
  14. - control-plane-tag2
  15. replicas: 3
  16. compute: (2)
  17. - hyperthreading: Enabled (3)
  18. name: worker
  19. platform:
  20. gcp:
  21. type: n2-standard-4
  22. zones:
  23. - us-central1-a
  24. - us-central1-c
  25. tags: (5)
  26. - compute-tag1
  27. - compute-tag2
  28. replicas: 0
  29. metadata:
  30. name: test-cluster
  31. networking:
  32. clusterNetwork:
  33. - cidr: 10.128.0.0/14
  34. hostPrefix: 23
  35. machineNetwork:
  36. - cidr: 10.0.0.0/16
  37. networkType: OVNKubernetes (6)
  38. serviceNetwork:
  39. - 172.30.0.0/16
  40. platform:
  41. gcp:
  42. defaultMachinePlatform:
  43. tags: (5)
  44. - global-tag1
  45. - global-tag2
  46. projectID: openshift-production (7)
  47. region: us-central1 (8)
  48. pullSecret: '{"auths": ...}'
  49. sshKey: ssh-ed25519 AAAA... (9)
  50. publish: Internal (10)
1Specify the public DNS on the host project.
2If you do not provide these parameters and values, the installation program provides the default value.
3The 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. Although both sections currently define a single machine pool, it is possible that future versions of OKD will support defining multiple compute pools during installation. Only one control plane pool is used.
4Whether to enable or disable simultaneous multithreading, or hyperthreading. By default, simultaneous multithreading is enabled to increase the performance of your machines’ cores. You can disable it by setting the parameter value to Disabled. If you disable simultaneous multithreading in some cluster machines, you must disable it in all cluster machines.

If you disable simultaneous multithreading, ensure that your capacity planning accounts for the dramatically decreased machine performance. Use larger machine types, such as n1-standard-8, for your machines if you disable simultaneous multithreading.

5Optional: A set of network tags to apply to the control plane or compute machine sets. The platform.gcp.defaultMachinePlatform.tags parameter applies to both control plane and compute machines. If the compute.platform.gcp.tags or controlPlane.platform.gcp.tags parameters are set, they override the platform.gcp.defaultMachinePlatform.tags parameter.
6The cluster network plugin to install. The supported values are OVNKubernetes and OpenShiftSDN. The default value is OVNKubernetes.
7Specify the main project where the VM instances reside.
8Specify the region that your VPC network is in.
9You can optionally provide the sshKey value that you use to access the machines in your cluster.

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.

10How to publish the user-facing endpoints of your cluster. Set publish to Internal to deploy a private cluster, which cannot be accessed from the internet. The default value is External. To use a shared VPC in a cluster that uses infrastructure that you provision, you must set publish to Internal. The installation program will no longer be able to access the public DNS zone for the base domain in the host project.

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.
    4If provided, the installation program generates a config map that is named user-ca-bundle in the openshift-config namespace that contains one or more additional CA certificates that are required for proxying HTTPS connections. The Cluster Network Operator then creates a trusted-ca-bundle config map that merges these contents with the Fedora CoreOS (FCOS) trust bundle, and this config map is referenced in the trustedCA field of the Proxy object. 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.

Creating the Kubernetes manifest and Ignition config files

Because you must modify some cluster definition files and manually start the cluster machines, you must generate the Kubernetes manifest and Ignition config files that the cluster needs to configure the machines.

The installation configuration file transforms into the Kubernetes manifests. The manifests wrap into the Ignition configuration files, which are later used to configure the cluster machines.

  • The Ignition config files that the OKD 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.

Prerequisites

  • You obtained the OKD installation program.

  • You created the install-config.yaml installation configuration file.

Procedure

  1. Change to the directory that contains the OKD installation program and generate the Kubernetes manifests for the cluster:

    1. $ ./openshift-install create manifests --dir <installation_directory> (1)
    1For <installation_directory>, specify the installation directory that contains the install-config.yaml file you created.
  2. Remove the Kubernetes manifest files that define the control plane machines:

    1. $ rm -f <installation_directory>/openshift/99_openshift-cluster-api_master-machines-*.yaml

    By removing these files, you prevent the cluster from automatically generating control plane machines.

  3. Remove the Kubernetes manifest files that define the control plane machine set:

    1. $ rm -f <installation_directory>/openshift/99_openshift-machine-api_master-control-plane-machine-set.yaml
  4. Remove the Kubernetes manifest files that define the worker machines:

    1. $ rm -f <installation_directory>/openshift/99_openshift-cluster-api_worker-machineset-*.yaml

    Because you create and manage the worker machines yourself, you do not need to initialize these machines.

  5. Check that the mastersSchedulable parameter in the <installation_directory>/manifests/cluster-scheduler-02-config.yml Kubernetes manifest file is set to false. This setting prevents pods from being scheduled on the control plane machines:

    1. Open the <installation_directory>/manifests/cluster-scheduler-02-config.yml file.

    2. Locate the mastersSchedulable parameter and ensure that it is set to false.

    3. Save and exit the file.

  6. Remove the privateZone sections from the <installation_directory>/manifests/cluster-dns-02-config.yml DNS configuration file:

    1. apiVersion: config.openshift.io/v1
    2. kind: DNS
    3. metadata:
    4. creationTimestamp: null
    5. name: cluster
    6. spec:
    7. baseDomain: example.openshift.com
    8. privateZone: (1)
    9. id: mycluster-100419-private-zone
    10. status: {}
    1Remove this section completely.
  7. Configure the cloud provider for your VPC.

    1. Open the <installation_directory>/manifests/cloud-provider-config.yaml file.

    2. Add the network-project-id parameter and set its value to the ID of project that hosts the shared VPC network.

    3. Add the network-name parameter and set its value to the name of the shared VPC network that hosts the OKD cluster.

    4. Replace the value of the subnetwork-name parameter with the value of the shared VPC subnet that hosts your compute machines.

    The contents of the <installation_directory>/manifests/cloud-provider-config.yaml resemble the following example:

    1. config: |+
    2. [global]
    3. project-id = example-project
    4. regional = true
    5. multizone = true
    6. node-tags = opensh-ptzzx-master
    7. node-tags = opensh-ptzzx-worker
    8. node-instance-prefix = opensh-ptzzx
    9. external-instance-groups-prefix = opensh-ptzzx
    10. network-project-id = example-shared-vpc
    11. network-name = example-network
    12. subnetwork-name = example-worker-subnet
  8. If you deploy a cluster that is not on a private network, open the <installation_directory>/manifests/cluster-ingress-default-ingresscontroller.yaml file and replace the value of the scope parameter with External. The contents of the file resemble the following example:

    1. apiVersion: operator.openshift.io/v1
    2. kind: IngressController
    3. metadata:
    4. creationTimestamp: null
    5. name: default
    6. namespace: openshift-ingress-operator
    7. spec:
    8. endpointPublishingStrategy:
    9. loadBalancer:
    10. scope: External
    11. type: LoadBalancerService
    12. status:
    13. availableReplicas: 0
    14. domain: ''
    15. selector: ''
  9. To create the Ignition configuration files, run the following command from the directory that contains the installation program:

    1. $ ./openshift-install create ignition-configs --dir <installation_directory> (1)
    1For <installation_directory>, specify the same installation directory.

    Ignition config files are created for the bootstrap, control plane, and compute nodes in the installation directory. The kubeadmin-password and kubeconfig files are created in the ./<installation_directory>/auth directory:

    1. .
    2. ├── auth
    3. ├── kubeadmin-password
    4. └── kubeconfig
    5. ├── bootstrap.ign
    6. ├── master.ign
    7. ├── metadata.json
    8. └── worker.ign

Exporting common variables

Extracting the infrastructure name

The Ignition config files contain a unique cluster identifier that you can use to uniquely identify your cluster in Google Cloud Platform (GCP). The infrastructure name is also used to locate the appropriate GCP resources during an OKD installation. The provided Deployment Manager templates contain references to this infrastructure name, so you must extract it.

Prerequisites

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

  • You generated the Ignition config files for your cluster.

  • You installed the jq package.

Procedure

  • To extract and view the infrastructure name from the Ignition config file metadata, run the following command:

    1. $ jq -r .infraID <installation_directory>/metadata.json (1)
    1For <installation_directory>, specify the path to the directory that you stored the installation files in.

    Example output

    1. openshift-vw9j6 (1)
    1The output of this command is your cluster name and a random string.

Exporting common variables for Deployment Manager templates

You must export a common set of variables that are used with the provided Deployment Manager templates used to assist in completing a user-provided infrastructure install on Google Cloud Platform (GCP).

Specific Deployment Manager templates can also require additional exported variables, which are detailed in their related procedures.

Prerequisites

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

  • Generate the Ignition config files for your cluster.

  • Install the jq package.

Procedure

  1. Export the following common variables to be used by the provided Deployment Manager templates:
  1. $ export BASE_DOMAIN='<base_domain>' (1)
  2. $ export BASE_DOMAIN_ZONE_NAME='<base_domain_zone_name>' (1)
  3. $ export NETWORK_CIDR='10.0.0.0/16'
  4. $ export KUBECONFIG=<installation_directory>/auth/kubeconfig (2)
  5. $ export CLUSTER_NAME=`jq -r .clusterName <installation_directory>/metadata.json`
  6. $ export INFRA_ID=`jq -r .infraID <installation_directory>/metadata.json`
  7. $ export PROJECT_NAME=`jq -r .gcp.projectID <installation_directory>/metadata.json`
1Supply the values for the host project.
2For <installation_directory>, specify the path to the directory that you stored the installation files in.

Networking requirements for user-provisioned infrastructure

All the Fedora CoreOS (FCOS) machines require networking to be configured in initramfs during boot to fetch their Ignition config files.

Setting the cluster node hostnames through DHCP

On Fedora CoreOS (FCOS) machines, the hostname is set through NetworkManager. By default, the machines obtain their hostname through DHCP. If the hostname is not provided by DHCP, set statically through kernel arguments, or another method, it is obtained through a reverse DNS lookup. Reverse DNS lookup occurs after the network has been initialized on a node and can take time to resolve. Other system services can start prior to this and detect the hostname as localhost or similar. You can avoid this by using DHCP to provide the hostname for each cluster node.

Additionally, setting the hostnames through DHCP can bypass any manual DNS record name configuration errors in environments that have a DNS split-horizon implementation.

Network connectivity requirements

You must configure the network connectivity between machines to allow OKD cluster components to communicate. Each machine must be able to resolve the hostnames of all other machines in the cluster.

This section provides details about the ports that are required.

In connected OKD environments, all nodes are required to have internet access to pull images for platform containers and provide telemetry data to Red Hat.

Table 7. Ports used for all-machine to all-machine communications
ProtocolPortDescription

ICMP

N/A

Network reachability tests

TCP

1936

Metrics

9000-9999

Host level services, including the node exporter on ports 9100-9101 and the Cluster Version Operator on port 9099.

10250-10259

The default ports that Kubernetes reserves

10256

openshift-sdn

UDP

4789

VXLAN

6081

Geneve

9000-9999

Host level services, including the node exporter on ports 9100-9101.

500

IPsec IKE packets

4500

IPsec NAT-T packets

TCP/UDP

30000-32767

Kubernetes node port

ESP

N/A

IPsec Encapsulating Security Payload (ESP)

Table 8. Ports used for all-machine to control plane communications
ProtocolPortDescription

TCP

6443

Kubernetes API

Table 9. Ports used for control plane machine to control plane machine communications
ProtocolPortDescription

TCP

2379-2380

etcd server and peer ports

Creating load balancers in GCP

You must configure load balancers in Google Cloud Platform (GCP) for your OKD cluster to use. One way to create these components is to modify the provided Deployment Manager template.

If you do not use the provided Deployment Manager template to create your GCP infrastructure, you must review the provided information and manually create the infrastructure. If your cluster does not initialize correctly, you might have to contact Red Hat support with your installation logs.

Prerequisites

  • Configure a GCP account.

  • Generate the Ignition config files for your cluster.

  • Create and configure a VPC and associated subnets in GCP.

Procedure

  1. Copy the template from the Deployment Manager template for the internal load balancer section of this topic and save it as 02_lb_int.py on your computer. This template describes the internal load balancing objects that your cluster requires.

  2. For an external cluster, also copy the template from the Deployment Manager template for the external load balancer section of this topic and save it as 02_lb_ext.py on your computer. This template describes the external load balancing objects that your cluster requires.

  3. Export the variables that the deployment template uses:

    1. Export the cluster network location:

      1. $ export CLUSTER_NETWORK=(`gcloud compute networks describe ${HOST_PROJECT_NETWORK} --project ${HOST_PROJECT} --account ${HOST_PROJECT_ACCOUNT} --format json | jq -r .selfLink`)
    2. Export the control plane subnet location:

      1. $ export CONTROL_SUBNET=(`gcloud compute networks subnets describe ${HOST_PROJECT_CONTROL_SUBNET} --region=${REGION} --project ${HOST_PROJECT} --account ${HOST_PROJECT_ACCOUNT} --format json | jq -r .selfLink`)
    3. Export the three zones that the cluster uses:

      1. $ export ZONE_0=(`gcloud compute regions describe ${REGION} --format=json | jq -r .zones[0] | cut -d "/" -f9`)
      1. $ export ZONE_1=(`gcloud compute regions describe ${REGION} --format=json | jq -r .zones[1] | cut -d "/" -f9`)
      1. $ export ZONE_2=(`gcloud compute regions describe ${REGION} --format=json | jq -r .zones[2] | cut -d "/" -f9`)
  4. Create a 02_infra.yaml resource definition file:

    1. $ cat <<EOF >02_infra.yaml
    2. imports:
    3. - path: 02_lb_ext.py
    4. - path: 02_lb_int.py (1)
    5. resources:
    6. - name: cluster-lb-ext (1)
    7. type: 02_lb_ext.py
    8. properties:
    9. infra_id: '${INFRA_ID}' (2)
    10. region: '${REGION}' (3)
    11. - name: cluster-lb-int
    12. type: 02_lb_int.py
    13. properties:
    14. cluster_network: '${CLUSTER_NETWORK}'
    15. control_subnet: '${CONTROL_SUBNET}' (4)
    16. infra_id: '${INFRA_ID}'
    17. region: '${REGION}'
    18. zones: (5)
    19. - '${ZONE_0}'
    20. - '${ZONE_1}'
    21. - '${ZONE_2}'
    22. EOF
    1Required only when deploying an external cluster.
    2infra_id is the INFRA_ID infrastructure name from the extraction step.
    3region is the region to deploy the cluster into, for example us-central1.
    4control_subnet is the URI to the control subnet.
    5zones are the zones to deploy the control plane instances into, like us-east1-b, us-east1-c, and us-east1-d.
  5. Create the deployment by using the gcloud CLI:

    1. $ gcloud deployment-manager deployments create ${INFRA_ID}-infra --config 02_infra.yaml
  6. Export the cluster IP address:

    1. $ export CLUSTER_IP=(`gcloud compute addresses describe ${INFRA_ID}-cluster-ip --region=${REGION} --format json | jq -r .address`)
  7. For an external cluster, also export the cluster public IP address:

    1. $ export CLUSTER_PUBLIC_IP=(`gcloud compute addresses describe ${INFRA_ID}-cluster-public-ip --region=${REGION} --format json | jq -r .address`)

Deployment Manager template for the external load balancer

You can use the following Deployment Manager template to deploy the external load balancer that you need for your OKD cluster:

02_lb_ext.py Deployment Manager template

  1. def GenerateConfig(context):
  2. resources = [{
  3. 'name': context.properties['infra_id'] + '-cluster-public-ip',
  4. 'type': 'compute.v1.address',
  5. 'properties': {
  6. 'region': context.properties['region']
  7. }
  8. }, {
  9. # Refer to docs/dev/kube-apiserver-health-check.md on how to correctly setup health check probe for kube-apiserver
  10. 'name': context.properties['infra_id'] + '-api-http-health-check',
  11. 'type': 'compute.v1.httpHealthCheck',
  12. 'properties': {
  13. 'port': 6080,
  14. 'requestPath': '/readyz'
  15. }
  16. }, {
  17. 'name': context.properties['infra_id'] + '-api-target-pool',
  18. 'type': 'compute.v1.targetPool',
  19. 'properties': {
  20. 'region': context.properties['region'],
  21. 'healthChecks': ['$(ref.' + context.properties['infra_id'] + '-api-http-health-check.selfLink)'],
  22. 'instances': []
  23. }
  24. }, {
  25. 'name': context.properties['infra_id'] + '-api-forwarding-rule',
  26. 'type': 'compute.v1.forwardingRule',
  27. 'properties': {
  28. 'region': context.properties['region'],
  29. 'IPAddress': '$(ref.' + context.properties['infra_id'] + '-cluster-public-ip.selfLink)',
  30. 'target': '$(ref.' + context.properties['infra_id'] + '-api-target-pool.selfLink)',
  31. 'portRange': '6443'
  32. }
  33. }]
  34. return {'resources': resources}

Deployment Manager template for the internal load balancer

You can use the following Deployment Manager template to deploy the internal load balancer that you need for your OKD cluster:

02_lb_int.py Deployment Manager template

  1. def GenerateConfig(context):
  2. backends = []
  3. for zone in context.properties['zones']:
  4. backends.append({
  5. 'group': '$(ref.' + context.properties['infra_id'] + '-master-' + zone + '-ig' + '.selfLink)'
  6. })
  7. resources = [{
  8. 'name': context.properties['infra_id'] + '-cluster-ip',
  9. 'type': 'compute.v1.address',
  10. 'properties': {
  11. 'addressType': 'INTERNAL',
  12. 'region': context.properties['region'],
  13. 'subnetwork': context.properties['control_subnet']
  14. }
  15. }, {
  16. # Refer to docs/dev/kube-apiserver-health-check.md on how to correctly setup health check probe for kube-apiserver
  17. 'name': context.properties['infra_id'] + '-api-internal-health-check',
  18. 'type': 'compute.v1.healthCheck',
  19. 'properties': {
  20. 'httpsHealthCheck': {
  21. 'port': 6443,
  22. 'requestPath': '/readyz'
  23. },
  24. 'type': "HTTPS"
  25. }
  26. }, {
  27. 'name': context.properties['infra_id'] + '-api-internal-backend-service',
  28. 'type': 'compute.v1.regionBackendService',
  29. 'properties': {
  30. 'backends': backends,
  31. 'healthChecks': ['$(ref.' + context.properties['infra_id'] + '-api-internal-health-check.selfLink)'],
  32. 'loadBalancingScheme': 'INTERNAL',
  33. 'region': context.properties['region'],
  34. 'protocol': 'TCP',
  35. 'timeoutSec': 120
  36. }
  37. }, {
  38. 'name': context.properties['infra_id'] + '-api-internal-forwarding-rule',
  39. 'type': 'compute.v1.forwardingRule',
  40. 'properties': {
  41. 'backendService': '$(ref.' + context.properties['infra_id'] + '-api-internal-backend-service.selfLink)',
  42. 'IPAddress': '$(ref.' + context.properties['infra_id'] + '-cluster-ip.selfLink)',
  43. 'loadBalancingScheme': 'INTERNAL',
  44. 'ports': ['6443','22623'],
  45. 'region': context.properties['region'],
  46. 'subnetwork': context.properties['control_subnet']
  47. }
  48. }]
  49. for zone in context.properties['zones']:
  50. resources.append({
  51. 'name': context.properties['infra_id'] + '-master-' + zone + '-ig',
  52. 'type': 'compute.v1.instanceGroup',
  53. 'properties': {
  54. 'namedPorts': [
  55. {
  56. 'name': 'ignition',
  57. 'port': 22623
  58. }, {
  59. 'name': 'https',
  60. 'port': 6443
  61. }
  62. ],
  63. 'network': context.properties['cluster_network'],
  64. 'zone': zone
  65. }
  66. })
  67. return {'resources': resources}

You will need this template in addition to the 02_lb_ext.py template when you create an external cluster.

Creating a private DNS zone in GCP

You must configure a private DNS zone in Google Cloud Platform (GCP) for your OKD cluster to use. One way to create this component is to modify the provided Deployment Manager template.

If you do not use the provided Deployment Manager template to create your GCP infrastructure, you must review the provided information and manually create the infrastructure. If your cluster does not initialize correctly, you might have to contact Red Hat support with your installation logs.

Prerequisites

  • Configure a GCP account.

  • Generate the Ignition config files for your cluster.

  • Create and configure a VPC and associated subnets in GCP.

Procedure

  1. Copy the template from the Deployment Manager template for the private DNS section of this topic and save it as 02_dns.py on your computer. This template describes the private DNS objects that your cluster requires.

  2. Create a 02_dns.yaml resource definition file:

    1. $ cat <<EOF >02_dns.yaml
    2. imports:
    3. - path: 02_dns.py
    4. resources:
    5. - name: cluster-dns
    6. type: 02_dns.py
    7. properties:
    8. infra_id: '${INFRA_ID}' (1)
    9. cluster_domain: '${CLUSTER_NAME}.${BASE_DOMAIN}' (2)
    10. cluster_network: '${CLUSTER_NETWORK}' (3)
    11. EOF
    1infra_id is the INFRA_ID infrastructure name from the extraction step.
    2cluster_domain is the domain for the cluster, for example openshift.example.com.
    3cluster_network is the selfLink URL to the cluster network.
  3. Create the deployment by using the gcloud CLI:

    1. $ gcloud deployment-manager deployments create ${INFRA_ID}-dns --config 02_dns.yaml --project ${HOST_PROJECT} --account ${HOST_PROJECT_ACCOUNT}
  4. The templates do not create DNS entries due to limitations of Deployment Manager, so you must create them manually:

    1. Add the internal DNS entries:

      1. $ if [ -f transaction.yaml ]; then rm transaction.yaml; fi
      2. $ gcloud dns record-sets transaction start --zone ${INFRA_ID}-private-zone --project ${HOST_PROJECT} --account ${HOST_PROJECT_ACCOUNT}
      3. $ gcloud dns record-sets transaction add ${CLUSTER_IP} --name api.${CLUSTER_NAME}.${BASE_DOMAIN}. --ttl 60 --type A --zone ${INFRA_ID}-private-zone --project ${HOST_PROJECT} --account ${HOST_PROJECT_ACCOUNT}
      4. $ gcloud dns record-sets transaction add ${CLUSTER_IP} --name api-int.${CLUSTER_NAME}.${BASE_DOMAIN}. --ttl 60 --type A --zone ${INFRA_ID}-private-zone --project ${HOST_PROJECT} --account ${HOST_PROJECT_ACCOUNT}
      5. $ gcloud dns record-sets transaction execute --zone ${INFRA_ID}-private-zone --project ${HOST_PROJECT} --account ${HOST_PROJECT_ACCOUNT}
    2. For an external cluster, also add the external DNS entries:

      1. $ if [ -f transaction.yaml ]; then rm transaction.yaml; fi
      2. $ gcloud --account=${HOST_PROJECT_ACCOUNT} --project=${HOST_PROJECT} dns record-sets transaction start --zone ${BASE_DOMAIN_ZONE_NAME}
      3. $ gcloud --account=${HOST_PROJECT_ACCOUNT} --project=${HOST_PROJECT} dns record-sets transaction add ${CLUSTER_PUBLIC_IP} --name api.${CLUSTER_NAME}.${BASE_DOMAIN}. --ttl 60 --type A --zone ${BASE_DOMAIN_ZONE_NAME}
      4. $ gcloud --account=${HOST_PROJECT_ACCOUNT} --project=${HOST_PROJECT} dns record-sets transaction execute --zone ${BASE_DOMAIN_ZONE_NAME}

Deployment Manager template for the private DNS

You can use the following Deployment Manager template to deploy the private DNS that you need for your OKD cluster:

02_dns.py Deployment Manager template

  1. def GenerateConfig(context):
  2. resources = [{
  3. 'name': context.properties['infra_id'] + '-private-zone',
  4. 'type': 'dns.v1.managedZone',
  5. 'properties': {
  6. 'description': '',
  7. 'dnsName': context.properties['cluster_domain'] + '.',
  8. 'visibility': 'private',
  9. 'privateVisibilityConfig': {
  10. 'networks': [{
  11. 'networkUrl': context.properties['cluster_network']
  12. }]
  13. }
  14. }
  15. }]
  16. return {'resources': resources}

Creating firewall rules in GCP

You must create firewall rules in Google Cloud Platform (GCP) for your OKD cluster to use. One way to create these components is to modify the provided Deployment Manager template.

If you do not use the provided Deployment Manager template to create your GCP infrastructure, you must review the provided information and manually create the infrastructure. If your cluster does not initialize correctly, you might have to contact Red Hat support with your installation logs.

Prerequisites

  • Configure a GCP account.

  • Generate the Ignition config files for your cluster.

  • Create and configure a VPC and associated subnets in GCP.

Procedure

  1. Copy the template from the Deployment Manager template for firewall rules section of this topic and save it as 03_firewall.py on your computer. This template describes the security groups that your cluster requires.

  2. Create a 03_firewall.yaml resource definition file:

    1. $ cat <<EOF >03_firewall.yaml
    2. imports:
    3. - path: 03_firewall.py
    4. resources:
    5. - name: cluster-firewall
    6. type: 03_firewall.py
    7. properties:
    8. allowed_external_cidr: '0.0.0.0/0' (1)
    9. infra_id: '${INFRA_ID}' (2)
    10. cluster_network: '${CLUSTER_NETWORK}' (3)
    11. network_cidr: '${NETWORK_CIDR}' (4)
    12. EOF
    1allowed_external_cidr is the CIDR range that can access the cluster API and SSH to the bootstrap host. For an internal cluster, set this value to ${NETWORK_CIDR}.
    2infra_id is the INFRA_ID infrastructure name from the extraction step.
    3cluster_network is the selfLink URL to the cluster network.
    4network_cidr is the CIDR of the VPC network, for example 10.0.0.0/16.
  3. Create the deployment by using the gcloud CLI:

    1. $ gcloud deployment-manager deployments create ${INFRA_ID}-firewall --config 03_firewall.yaml --project ${HOST_PROJECT} --account ${HOST_PROJECT_ACCOUNT}

Deployment Manager template for firewall rules

You can use the following Deployment Manager template to deploy the firewall rues that you need for your OKD cluster:

03_firewall.py Deployment Manager template

  1. def GenerateConfig(context):
  2. resources = [{
  3. 'name': context.properties['infra_id'] + '-bootstrap-in-ssh',
  4. 'type': 'compute.v1.firewall',
  5. 'properties': {
  6. 'network': context.properties['cluster_network'],
  7. 'allowed': [{
  8. 'IPProtocol': 'tcp',
  9. 'ports': ['22']
  10. }],
  11. 'sourceRanges': [context.properties['allowed_external_cidr']],
  12. 'targetTags': [context.properties['infra_id'] + '-bootstrap']
  13. }
  14. }, {
  15. 'name': context.properties['infra_id'] + '-api',
  16. 'type': 'compute.v1.firewall',
  17. 'properties': {
  18. 'network': context.properties['cluster_network'],
  19. 'allowed': [{
  20. 'IPProtocol': 'tcp',
  21. 'ports': ['6443']
  22. }],
  23. 'sourceRanges': [context.properties['allowed_external_cidr']],
  24. 'targetTags': [context.properties['infra_id'] + '-master']
  25. }
  26. }, {
  27. 'name': context.properties['infra_id'] + '-health-checks',
  28. 'type': 'compute.v1.firewall',
  29. 'properties': {
  30. 'network': context.properties['cluster_network'],
  31. 'allowed': [{
  32. 'IPProtocol': 'tcp',
  33. 'ports': ['6080', '6443', '22624']
  34. }],
  35. 'sourceRanges': ['35.191.0.0/16', '130.211.0.0/22', '209.85.152.0/22', '209.85.204.0/22'],
  36. 'targetTags': [context.properties['infra_id'] + '-master']
  37. }
  38. }, {
  39. 'name': context.properties['infra_id'] + '-etcd',
  40. 'type': 'compute.v1.firewall',
  41. 'properties': {
  42. 'network': context.properties['cluster_network'],
  43. 'allowed': [{
  44. 'IPProtocol': 'tcp',
  45. 'ports': ['2379-2380']
  46. }],
  47. 'sourceTags': [context.properties['infra_id'] + '-master'],
  48. 'targetTags': [context.properties['infra_id'] + '-master']
  49. }
  50. }, {
  51. 'name': context.properties['infra_id'] + '-control-plane',
  52. 'type': 'compute.v1.firewall',
  53. 'properties': {
  54. 'network': context.properties['cluster_network'],
  55. 'allowed': [{
  56. 'IPProtocol': 'tcp',
  57. 'ports': ['10257']
  58. },{
  59. 'IPProtocol': 'tcp',
  60. 'ports': ['10259']
  61. },{
  62. 'IPProtocol': 'tcp',
  63. 'ports': ['22623']
  64. }],
  65. 'sourceTags': [
  66. context.properties['infra_id'] + '-master',
  67. context.properties['infra_id'] + '-worker'
  68. ],
  69. 'targetTags': [context.properties['infra_id'] + '-master']
  70. }
  71. }, {
  72. 'name': context.properties['infra_id'] + '-internal-network',
  73. 'type': 'compute.v1.firewall',
  74. 'properties': {
  75. 'network': context.properties['cluster_network'],
  76. 'allowed': [{
  77. 'IPProtocol': 'icmp'
  78. },{
  79. 'IPProtocol': 'tcp',
  80. 'ports': ['22']
  81. }],
  82. 'sourceRanges': [context.properties['network_cidr']],
  83. 'targetTags': [
  84. context.properties['infra_id'] + '-master',
  85. context.properties['infra_id'] + '-worker'
  86. ]
  87. }
  88. }, {
  89. 'name': context.properties['infra_id'] + '-internal-cluster',
  90. 'type': 'compute.v1.firewall',
  91. 'properties': {
  92. 'network': context.properties['cluster_network'],
  93. 'allowed': [{
  94. 'IPProtocol': 'udp',
  95. 'ports': ['4789', '6081']
  96. },{
  97. 'IPProtocol': 'udp',
  98. 'ports': ['500', '4500']
  99. },{
  100. 'IPProtocol': 'esp',
  101. },{
  102. 'IPProtocol': 'tcp',
  103. 'ports': ['9000-9999']
  104. },{
  105. 'IPProtocol': 'udp',
  106. 'ports': ['9000-9999']
  107. },{
  108. 'IPProtocol': 'tcp',
  109. 'ports': ['10250']
  110. },{
  111. 'IPProtocol': 'tcp',
  112. 'ports': ['30000-32767']
  113. },{
  114. 'IPProtocol': 'udp',
  115. 'ports': ['30000-32767']
  116. }],
  117. 'sourceTags': [
  118. context.properties['infra_id'] + '-master',
  119. context.properties['infra_id'] + '-worker'
  120. ],
  121. 'targetTags': [
  122. context.properties['infra_id'] + '-master',
  123. context.properties['infra_id'] + '-worker'
  124. ]
  125. }
  126. }]
  127. return {'resources': resources}

Creating IAM roles in GCP

You must create IAM roles in Google Cloud Platform (GCP) for your OKD cluster to use. One way to create these components is to modify the provided Deployment Manager template.

If you do not use the provided Deployment Manager template to create your GCP infrastructure, you must review the provided information and manually create the infrastructure. If your cluster does not initialize correctly, you might have to contact Red Hat support with your installation logs.

Prerequisites

  • Configure a GCP account.

  • Generate the Ignition config files for your cluster.

  • Create and configure a VPC and associated subnets in GCP.

Procedure

  1. Copy the template from the Deployment Manager template for IAM roles section of this topic and save it as 03_iam.py on your computer. This template describes the IAM roles that your cluster requires.

  2. Create a 03_iam.yaml resource definition file:

    1. $ cat <<EOF >03_iam.yaml
    2. imports:
    3. - path: 03_iam.py
    4. resources:
    5. - name: cluster-iam
    6. type: 03_iam.py
    7. properties:
    8. infra_id: '${INFRA_ID}' (1)
    9. EOF
    1infra_id is the INFRA_ID infrastructure name from the extraction step.
  3. Create the deployment by using the gcloud CLI:

    1. $ gcloud deployment-manager deployments create ${INFRA_ID}-iam --config 03_iam.yaml
  4. Export the variable for the master service account:

    1. $ export MASTER_SERVICE_ACCOUNT=(`gcloud iam service-accounts list --filter "email~^${INFRA_ID}-m@${PROJECT_NAME}." --format json | jq -r '.[0].email'`)
  5. Export the variable for the worker service account:

    1. $ export WORKER_SERVICE_ACCOUNT=(`gcloud iam service-accounts list --filter "email~^${INFRA_ID}-w@${PROJECT_NAME}." --format json | jq -r '.[0].email'`)
  6. Assign the permissions that the installation program requires to the service accounts for the subnets that host the control plane and compute subnets:

    1. Grant the networkViewer role of the project that hosts your shared VPC to the master service account:

      1. $ gcloud --account=${HOST_PROJECT_ACCOUNT} --project=${HOST_PROJECT} projects add-iam-policy-binding ${HOST_PROJECT} --member "serviceAccount:${MASTER_SERVICE_ACCOUNT}" --role "roles/compute.networkViewer"
    2. Grant the networkUser role to the master service account for the control plane subnet:

      1. $ gcloud --account=${HOST_PROJECT_ACCOUNT} --project=${HOST_PROJECT} compute networks subnets add-iam-policy-binding "${HOST_PROJECT_CONTROL_SUBNET}" --member "serviceAccount:${MASTER_SERVICE_ACCOUNT}" --role "roles/compute.networkUser" --region ${REGION}
    3. Grant the networkUser role to the worker service account for the control plane subnet:

      1. $ gcloud --account=${HOST_PROJECT_ACCOUNT} --project=${HOST_PROJECT} compute networks subnets add-iam-policy-binding "${HOST_PROJECT_CONTROL_SUBNET}" --member "serviceAccount:${WORKER_SERVICE_ACCOUNT}" --role "roles/compute.networkUser" --region ${REGION}
    4. Grant the networkUser role to the master service account for the compute subnet:

      1. $ gcloud --account=${HOST_PROJECT_ACCOUNT} --project=${HOST_PROJECT} compute networks subnets add-iam-policy-binding "${HOST_PROJECT_COMPUTE_SUBNET}" --member "serviceAccount:${MASTER_SERVICE_ACCOUNT}" --role "roles/compute.networkUser" --region ${REGION}
    5. Grant the networkUser role to the worker service account for the compute subnet:

      1. $ gcloud --account=${HOST_PROJECT_ACCOUNT} --project=${HOST_PROJECT} compute networks subnets add-iam-policy-binding "${HOST_PROJECT_COMPUTE_SUBNET}" --member "serviceAccount:${WORKER_SERVICE_ACCOUNT}" --role "roles/compute.networkUser" --region ${REGION}
  7. The templates do not create the policy bindings due to limitations of Deployment Manager, so you must create them manually:

    1. $ gcloud projects add-iam-policy-binding ${PROJECT_NAME} --member "serviceAccount:${MASTER_SERVICE_ACCOUNT}" --role "roles/compute.instanceAdmin"
    2. $ gcloud projects add-iam-policy-binding ${PROJECT_NAME} --member "serviceAccount:${MASTER_SERVICE_ACCOUNT}" --role "roles/compute.networkAdmin"
    3. $ gcloud projects add-iam-policy-binding ${PROJECT_NAME} --member "serviceAccount:${MASTER_SERVICE_ACCOUNT}" --role "roles/compute.securityAdmin"
    4. $ gcloud projects add-iam-policy-binding ${PROJECT_NAME} --member "serviceAccount:${MASTER_SERVICE_ACCOUNT}" --role "roles/iam.serviceAccountUser"
    5. $ gcloud projects add-iam-policy-binding ${PROJECT_NAME} --member "serviceAccount:${MASTER_SERVICE_ACCOUNT}" --role "roles/storage.admin"
    6. $ gcloud projects add-iam-policy-binding ${PROJECT_NAME} --member "serviceAccount:${WORKER_SERVICE_ACCOUNT}" --role "roles/compute.viewer"
    7. $ gcloud projects add-iam-policy-binding ${PROJECT_NAME} --member "serviceAccount:${WORKER_SERVICE_ACCOUNT}" --role "roles/storage.admin"
  8. Create a service account key and store it locally for later use:

    1. $ gcloud iam service-accounts keys create service-account-key.json --iam-account=${MASTER_SERVICE_ACCOUNT}

Deployment Manager template for IAM roles

You can use the following Deployment Manager template to deploy the IAM roles that you need for your OKD cluster:

03_iam.py Deployment Manager template

  1. def GenerateConfig(context):
  2. resources = [{
  3. 'name': context.properties['infra_id'] + '-master-node-sa',
  4. 'type': 'iam.v1.serviceAccount',
  5. 'properties': {
  6. 'accountId': context.properties['infra_id'] + '-m',
  7. 'displayName': context.properties['infra_id'] + '-master-node'
  8. }
  9. }, {
  10. 'name': context.properties['infra_id'] + '-worker-node-sa',
  11. 'type': 'iam.v1.serviceAccount',
  12. 'properties': {
  13. 'accountId': context.properties['infra_id'] + '-w',
  14. 'displayName': context.properties['infra_id'] + '-worker-node'
  15. }
  16. }]
  17. return {'resources': resources}

Creating the FCOS cluster image for the GCP infrastructure

You must use a valid Fedora CoreOS (FCOS) image for Google Cloud Platform (GCP) for your OKD nodes.

Procedure

  1. Obtain the FCOS image from the FCOS Downloads page

  2. Create the Google storage bucket:

    1. $ gsutil mb gs://<bucket_name>
  3. Upload the FCOS image to the Google storage bucket:

    1. $ gsutil cp <downloaded_image_file_path>/rhcos-<version>-x86_64-gcp.x86_64.tar.gz gs://<bucket_name>
  4. Export the uploaded FCOS image location as a variable:

    1. $ export IMAGE_SOURCE=gs://<bucket_name>/rhcos-<version>-x86_64-gcp.x86_64.tar.gz
  5. Create the cluster image:

    1. $ gcloud compute images create "${INFRA_ID}-rhcos-image" \
    2. --source-uri="${IMAGE_SOURCE}"

Creating the bootstrap machine in GCP

You must create the bootstrap machine in Google Cloud Platform (GCP) to use during OKD cluster initialization. One way to create this machine is to modify the provided Deployment Manager template.

If you do not use the provided Deployment Manager template to create your bootstrap machine, you must review the provided information and manually create the infrastructure. If your cluster does not initialize correctly, you might have to contact Red Hat support with your installation logs.

Prerequisites

  • Configure a GCP account.

  • Generate the Ignition config files for your cluster.

  • Create and configure a VPC and associated subnets in GCP.

  • Create and configure networking and load balancers in GCP.

  • Create control plane and compute roles.

  • Ensure pyOpenSSL is installed.

Procedure

  1. Copy the template from the Deployment Manager template for the bootstrap machine section of this topic and save it as 04_bootstrap.py on your computer. This template describes the bootstrap machine that your cluster requires.

  2. Export the location of the Fedora CoreOS (FCOS) image that the installation program requires:

    1. $ export CLUSTER_IMAGE=(`gcloud compute images describe ${INFRA_ID}-rhcos-image --format json | jq -r .selfLink`)
  3. Create a bucket and upload the bootstrap.ign file:

    1. $ gsutil mb gs://${INFRA_ID}-bootstrap-ignition
    2. $ gsutil cp <installation_directory>/bootstrap.ign gs://${INFRA_ID}-bootstrap-ignition/
  4. Create a signed URL for the bootstrap instance to use to access the Ignition config. Export the URL from the output as a variable:

    1. $ export BOOTSTRAP_IGN=`gsutil signurl -d 1h service-account-key.json gs://${INFRA_ID}-bootstrap-ignition/bootstrap.ign | grep "^gs:" | awk '{print $5}'`
  5. Create a 04_bootstrap.yaml resource definition file:

    1. $ cat <<EOF >04_bootstrap.yaml
    2. imports:
    3. - path: 04_bootstrap.py
    4. resources:
    5. - name: cluster-bootstrap
    6. type: 04_bootstrap.py
    7. properties:
    8. infra_id: '${INFRA_ID}' (1)
    9. region: '${REGION}' (2)
    10. zone: '${ZONE_0}' (3)
    11. cluster_network: '${CLUSTER_NETWORK}' (4)
    12. control_subnet: '${CONTROL_SUBNET}' (5)
    13. image: '${CLUSTER_IMAGE}' (6)
    14. machine_type: 'n1-standard-4' (7)
    15. root_volume_size: '128' (8)
    16. bootstrap_ign: '${BOOTSTRAP_IGN}' (9)
    17. EOF
    1infra_id is the INFRA_ID infrastructure name from the extraction step.
    2region is the region to deploy the cluster into, for example us-central1.
    3zone is the zone to deploy the bootstrap instance into, for example us-central1-b.
    4cluster_network is the selfLink URL to the cluster network.
    5control_subnet is the selfLink URL to the control subnet.
    6image is the selfLink URL to the FCOS image.
    7machine_type is the machine type of the instance, for example n1-standard-4.
    8root_volume_size is the boot disk size for the bootstrap machine.
    9bootstrap_ign is the URL output when creating a signed URL.
  6. Create the deployment by using the gcloud CLI:

    1. $ gcloud deployment-manager deployments create ${INFRA_ID}-bootstrap --config 04_bootstrap.yaml
  7. Add the bootstrap instance to the internal load balancer instance group:

    1. $ gcloud compute instance-groups unmanaged add-instances ${INFRA_ID}-bootstrap-instance-group --zone=${ZONE_0} --instances=${INFRA_ID}-bootstrap
  8. Add the bootstrap instance group to the internal load balancer backend service:

    1. $ gcloud compute backend-services add-backend ${INFRA_ID}-api-internal-backend-service --region=${REGION} --instance-group=${INFRA_ID}-bootstrap-instance-group --instance-group-zone=${ZONE_0}

Deployment Manager template for the bootstrap machine

You can use the following Deployment Manager template to deploy the bootstrap machine that you need for your OKD cluster:

04_bootstrap.py Deployment Manager template

  1. def GenerateConfig(context):
  2. resources = [{
  3. 'name': context.properties['infra_id'] + '-bootstrap-public-ip',
  4. 'type': 'compute.v1.address',
  5. 'properties': {
  6. 'region': context.properties['region']
  7. }
  8. }, {
  9. 'name': context.properties['infra_id'] + '-bootstrap',
  10. 'type': 'compute.v1.instance',
  11. 'properties': {
  12. 'disks': [{
  13. 'autoDelete': True,
  14. 'boot': True,
  15. 'initializeParams': {
  16. 'diskSizeGb': context.properties['root_volume_size'],
  17. 'sourceImage': context.properties['image']
  18. }
  19. }],
  20. 'machineType': 'zones/' + context.properties['zone'] + '/machineTypes/' + context.properties['machine_type'],
  21. 'metadata': {
  22. 'items': [{
  23. 'key': 'user-data',
  24. 'value': '{"ignition":{"config":{"replace":{"source":"' + context.properties['bootstrap_ign'] + '"}},"version":"3.2.0"}}',
  25. }]
  26. },
  27. 'networkInterfaces': [{
  28. 'subnetwork': context.properties['control_subnet'],
  29. 'accessConfigs': [{
  30. 'natIP': '$(ref.' + context.properties['infra_id'] + '-bootstrap-public-ip.address)'
  31. }]
  32. }],
  33. 'tags': {
  34. 'items': [
  35. context.properties['infra_id'] + '-master',
  36. context.properties['infra_id'] + '-bootstrap'
  37. ]
  38. },
  39. 'zone': context.properties['zone']
  40. }
  41. }, {
  42. 'name': context.properties['infra_id'] + '-bootstrap-ig',
  43. 'type': 'compute.v1.instanceGroup',
  44. 'properties': {
  45. 'namedPorts': [
  46. {
  47. 'name': 'ignition',
  48. 'port': 22623
  49. }, {
  50. 'name': 'https',
  51. 'port': 6443
  52. }
  53. ],
  54. 'network': context.properties['cluster_network'],
  55. 'zone': context.properties['zone']
  56. }
  57. }]
  58. return {'resources': resources}

Creating the control plane machines in GCP

You must create the control plane machines in Google Cloud Platform (GCP) for your cluster to use. One way to create these machines is to modify the provided Deployment Manager template.

If you do not use the provided Deployment Manager template to create your control plane machines, you must review the provided information and manually create the infrastructure. If your cluster does not initialize correctly, you might have to contact Red Hat support with your installation logs.

Prerequisites

  • Configure a GCP account.

  • Generate the Ignition config files for your cluster.

  • Create and configure a VPC and associated subnets in GCP.

  • Create and configure networking and load balancers in GCP.

  • Create control plane and compute roles.

  • Create the bootstrap machine.

Procedure

  1. Copy the template from the Deployment Manager template for control plane machines section of this topic and save it as 05_control_plane.py on your computer. This template describes the control plane machines that your cluster requires.

  2. Export the following variable required by the resource definition:

    1. $ export MASTER_IGNITION=`cat <installation_directory>/master.ign`
  3. Create a 05_control_plane.yaml resource definition file:

    1. $ cat <<EOF >05_control_plane.yaml
    2. imports:
    3. - path: 05_control_plane.py
    4. resources:
    5. - name: cluster-control-plane
    6. type: 05_control_plane.py
    7. properties:
    8. infra_id: '${INFRA_ID}' (1)
    9. zones: (2)
    10. - '${ZONE_0}'
    11. - '${ZONE_1}'
    12. - '${ZONE_2}'
    13. control_subnet: '${CONTROL_SUBNET}' (3)
    14. image: '${CLUSTER_IMAGE}' (4)
    15. machine_type: 'n1-standard-4' (5)
    16. root_volume_size: '128'
    17. service_account_email: '${MASTER_SERVICE_ACCOUNT}' (6)
    18. ignition: '${MASTER_IGNITION}' (7)
    19. EOF
    1infra_id is the INFRA_ID infrastructure name from the extraction step.
    2zones are the zones to deploy the control plane instances into, for example us-central1-a, us-central1-b, and us-central1-c.
    3control_subnet is the selfLink URL to the control subnet.
    4image is the selfLink URL to the FCOS image.
    5machine_type is the machine type of the instance, for example n1-standard-4.
    6service_account_email is the email address for the master service account that you created.
    7ignition is the contents of the master.ign file.
  4. Create the deployment by using the gcloud CLI:

    1. $ gcloud deployment-manager deployments create ${INFRA_ID}-control-plane --config 05_control_plane.yaml
  5. The templates do not manage load balancer membership due to limitations of Deployment Manager, so you must add the control plane machines manually.

    • Run the following commands to add the control plane machines to the appropriate instance groups:

      1. $ gcloud compute instance-groups unmanaged add-instances ${INFRA_ID}-master-${ZONE_0}-instance-group --zone=${ZONE_0} --instances=${INFRA_ID}-master-0
      2. $ gcloud compute instance-groups unmanaged add-instances ${INFRA_ID}-master-${ZONE_1}-instance-group --zone=${ZONE_1} --instances=${INFRA_ID}-master-1
      3. $ gcloud compute instance-groups unmanaged add-instances ${INFRA_ID}-master-${ZONE_2}-instance-group --zone=${ZONE_2} --instances=${INFRA_ID}-master-2
    • For an external cluster, you must also run the following commands to add the control plane machines to the target pools:

      1. $ gcloud compute target-pools add-instances ${INFRA_ID}-api-target-pool --instances-zone="${ZONE_0}" --instances=${INFRA_ID}-master-0
      2. $ gcloud compute target-pools add-instances ${INFRA_ID}-api-target-pool --instances-zone="${ZONE_1}" --instances=${INFRA_ID}-master-1
      3. $ gcloud compute target-pools add-instances ${INFRA_ID}-api-target-pool --instances-zone="${ZONE_2}" --instances=${INFRA_ID}-master-2

Deployment Manager template for control plane machines

You can use the following Deployment Manager template to deploy the control plane machines that you need for your OKD cluster:

05_control_plane.py Deployment Manager template

  1. def GenerateConfig(context):
  2. resources = [{
  3. 'name': context.properties['infra_id'] + '-master-0',
  4. 'type': 'compute.v1.instance',
  5. 'properties': {
  6. 'disks': [{
  7. 'autoDelete': True,
  8. 'boot': True,
  9. 'initializeParams': {
  10. 'diskSizeGb': context.properties['root_volume_size'],
  11. 'diskType': 'zones/' + context.properties['zones'][0] + '/diskTypes/pd-ssd',
  12. 'sourceImage': context.properties['image']
  13. }
  14. }],
  15. 'machineType': 'zones/' + context.properties['zones'][0] + '/machineTypes/' + context.properties['machine_type'],
  16. 'metadata': {
  17. 'items': [{
  18. 'key': 'user-data',
  19. 'value': context.properties['ignition']
  20. }]
  21. },
  22. 'networkInterfaces': [{
  23. 'subnetwork': context.properties['control_subnet']
  24. }],
  25. 'serviceAccounts': [{
  26. 'email': context.properties['service_account_email'],
  27. 'scopes': ['https://www.googleapis.com/auth/cloud-platform']
  28. }],
  29. 'tags': {
  30. 'items': [
  31. context.properties['infra_id'] + '-master',
  32. ]
  33. },
  34. 'zone': context.properties['zones'][0]
  35. }
  36. }, {
  37. 'name': context.properties['infra_id'] + '-master-1',
  38. 'type': 'compute.v1.instance',
  39. 'properties': {
  40. 'disks': [{
  41. 'autoDelete': True,
  42. 'boot': True,
  43. 'initializeParams': {
  44. 'diskSizeGb': context.properties['root_volume_size'],
  45. 'diskType': 'zones/' + context.properties['zones'][1] + '/diskTypes/pd-ssd',
  46. 'sourceImage': context.properties['image']
  47. }
  48. }],
  49. 'machineType': 'zones/' + context.properties['zones'][1] + '/machineTypes/' + context.properties['machine_type'],
  50. 'metadata': {
  51. 'items': [{
  52. 'key': 'user-data',
  53. 'value': context.properties['ignition']
  54. }]
  55. },
  56. 'networkInterfaces': [{
  57. 'subnetwork': context.properties['control_subnet']
  58. }],
  59. 'serviceAccounts': [{
  60. 'email': context.properties['service_account_email'],
  61. 'scopes': ['https://www.googleapis.com/auth/cloud-platform']
  62. }],
  63. 'tags': {
  64. 'items': [
  65. context.properties['infra_id'] + '-master',
  66. ]
  67. },
  68. 'zone': context.properties['zones'][1]
  69. }
  70. }, {
  71. 'name': context.properties['infra_id'] + '-master-2',
  72. 'type': 'compute.v1.instance',
  73. 'properties': {
  74. 'disks': [{
  75. 'autoDelete': True,
  76. 'boot': True,
  77. 'initializeParams': {
  78. 'diskSizeGb': context.properties['root_volume_size'],
  79. 'diskType': 'zones/' + context.properties['zones'][2] + '/diskTypes/pd-ssd',
  80. 'sourceImage': context.properties['image']
  81. }
  82. }],
  83. 'machineType': 'zones/' + context.properties['zones'][2] + '/machineTypes/' + context.properties['machine_type'],
  84. 'metadata': {
  85. 'items': [{
  86. 'key': 'user-data',
  87. 'value': context.properties['ignition']
  88. }]
  89. },
  90. 'networkInterfaces': [{
  91. 'subnetwork': context.properties['control_subnet']
  92. }],
  93. 'serviceAccounts': [{
  94. 'email': context.properties['service_account_email'],
  95. 'scopes': ['https://www.googleapis.com/auth/cloud-platform']
  96. }],
  97. 'tags': {
  98. 'items': [
  99. context.properties['infra_id'] + '-master',
  100. ]
  101. },
  102. 'zone': context.properties['zones'][2]
  103. }
  104. }]
  105. return {'resources': resources}

Wait for bootstrap completion and remove bootstrap resources in GCP

After you create all of the required infrastructure in Google Cloud Platform (GCP), wait for the bootstrap process to complete on the machines that you provisioned by using the Ignition config files that you generated with the installation program.

Prerequisites

  • Configure a GCP account.

  • Generate the Ignition config files for your cluster.

  • Create and configure a VPC and associated subnets in GCP.

  • Create and configure networking and load balancers in GCP.

  • Create control plane and compute roles.

  • Create the bootstrap machine.

  • Create the control plane machines.

Procedure

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

    1. $ ./openshift-install wait-for bootstrap-complete --dir <installation_directory> \ (1)
    2. --log-level info (2)
    1For <installation_directory>, specify the path to the directory that you stored the installation files in.
    2To view different installation details, specify warn, debug, or error instead of info.

    If the command exits without a FATAL warning, your production control plane has initialized.

  2. Delete the bootstrap resources:

    1. $ gcloud compute backend-services remove-backend ${INFRA_ID}-api-internal-backend-service --region=${REGION} --instance-group=${INFRA_ID}-bootstrap-instance-group --instance-group-zone=${ZONE_0}
    2. $ gsutil rm gs://${INFRA_ID}-bootstrap-ignition/bootstrap.ign
    3. $ gsutil rb gs://${INFRA_ID}-bootstrap-ignition
    4. $ gcloud deployment-manager deployments delete ${INFRA_ID}-bootstrap

Creating additional worker machines in GCP

You can create worker machines in Google Cloud Platform (GCP) for your cluster to use by launching individual instances discretely or by automated processes outside the cluster, such as auto scaling groups. You can also take advantage of the built-in cluster scaling mechanisms and the machine API in OKD.

In this example, you manually launch one instance by using the Deployment Manager template. Additional instances can be launched by including additional resources of type 06_worker.py in the file.

If you do not use the provided Deployment Manager template to create your worker machines, you must review the provided information and manually create the infrastructure. If your cluster does not initialize correctly, you might have to contact Red Hat support with your installation logs.

Prerequisites

  • Configure a GCP account.

  • Generate the Ignition config files for your cluster.

  • Create and configure a VPC and associated subnets in GCP.

  • Create and configure networking and load balancers in GCP.

  • Create control plane and compute roles.

  • Create the bootstrap machine.

  • Create the control plane machines.

Procedure

  1. Copy the template from the Deployment Manager template for worker machines section of this topic and save it as 06_worker.py on your computer. This template describes the worker machines that your cluster requires.

  2. Export the variables that the resource definition uses.

    1. Export the subnet that hosts the compute machines:

      1. $ export COMPUTE_SUBNET=(`gcloud compute networks subnets describe ${HOST_PROJECT_COMPUTE_SUBNET} --region=${REGION} --project ${HOST_PROJECT} --account ${HOST_PROJECT_ACCOUNT} --format json | jq -r .selfLink`)
    2. Export the email address for your service account:

      1. $ export WORKER_SERVICE_ACCOUNT=(`gcloud iam service-accounts list --filter "email~^${INFRA_ID}-w@${PROJECT_NAME}." --format json | jq -r '.[0].email'`)
    3. Export the location of the compute machine Ignition config file:

      1. $ export WORKER_IGNITION=`cat <installation_directory>/worker.ign`
  3. Create a 06_worker.yaml resource definition file:

    1. $ cat <<EOF >06_worker.yaml
    2. imports:
    3. - path: 06_worker.py
    4. resources:
    5. - name: 'worker-0' (1)
    6. type: 06_worker.py
    7. properties:
    8. infra_id: '${INFRA_ID}' (2)
    9. zone: '${ZONE_0}' (3)
    10. compute_subnet: '${COMPUTE_SUBNET}' (4)
    11. image: '${CLUSTER_IMAGE}' (5)
    12. machine_type: 'n1-standard-4' (6)
    13. root_volume_size: '128'
    14. service_account_email: '${WORKER_SERVICE_ACCOUNT}' (7)
    15. ignition: '${WORKER_IGNITION}' (8)
    16. - name: 'worker-1'
    17. type: 06_worker.py
    18. properties:
    19. infra_id: '${INFRA_ID}' (2)
    20. zone: '${ZONE_1}' (3)
    21. compute_subnet: '${COMPUTE_SUBNET}' (4)
    22. image: '${CLUSTER_IMAGE}' (5)
    23. machine_type: 'n1-standard-4' (6)
    24. root_volume_size: '128'
    25. service_account_email: '${WORKER_SERVICE_ACCOUNT}' (7)
    26. ignition: '${WORKER_IGNITION}' (8)
    27. EOF
    1name is the name of the worker machine, for example worker-0.
    2infra_id is the INFRA_ID infrastructure name from the extraction step.
    3zone is the zone to deploy the worker machine into, for example us-central1-a.
    4compute_subnet is the selfLink URL to the compute subnet.
    5image is the selfLink URL to the FCOS image. 1
    6machine_type is the machine type of the instance, for example n1-standard-4.
    7service_account_email is the email address for the worker service account that you created.
    8ignition is the contents of the worker.ign file.
  4. Optional: If you want to launch additional instances, include additional resources of type 06_worker.py in your 06_worker.yaml resource definition file.

  5. Create the deployment by using the gcloud CLI:

    1. $ gcloud deployment-manager deployments create ${INFRA_ID}-worker --config 06_worker.yaml
  6. To use a GCP Marketplace image, specify the offer to use:

    • OKD: https://www.googleapis.com/compute/v1/projects/redhat-marketplace-public/global/images/redhat-coreos-ocp-48-x86-64-202210040145

    • OpenShift Platform Plus: https://www.googleapis.com/compute/v1/projects/redhat-marketplace-public/global/images/redhat-coreos-opp-48-x86-64-202206140145

    • OpenShift Kubernetes Engine: https://www.googleapis.com/compute/v1/projects/redhat-marketplace-public/global/images/redhat-coreos-oke-48-x86-64-202206140145

Deployment Manager template for worker machines

You can use the following Deployment Manager template to deploy the worker machines that you need for your OKD cluster:

06_worker.py Deployment Manager template

  1. def GenerateConfig(context):
  2. resources = [{
  3. 'name': context.properties['infra_id'] + '-' + context.env['name'],
  4. 'type': 'compute.v1.instance',
  5. 'properties': {
  6. 'disks': [{
  7. 'autoDelete': True,
  8. 'boot': True,
  9. 'initializeParams': {
  10. 'diskSizeGb': context.properties['root_volume_size'],
  11. 'sourceImage': context.properties['image']
  12. }
  13. }],
  14. 'machineType': 'zones/' + context.properties['zone'] + '/machineTypes/' + context.properties['machine_type'],
  15. 'metadata': {
  16. 'items': [{
  17. 'key': 'user-data',
  18. 'value': context.properties['ignition']
  19. }]
  20. },
  21. 'networkInterfaces': [{
  22. 'subnetwork': context.properties['compute_subnet']
  23. }],
  24. 'serviceAccounts': [{
  25. 'email': context.properties['service_account_email'],
  26. 'scopes': ['https://www.googleapis.com/auth/cloud-platform']
  27. }],
  28. 'tags': {
  29. 'items': [
  30. context.properties['infra_id'] + '-worker',
  31. ]
  32. },
  33. 'zone': context.properties['zone']
  34. }
  35. }]
  36. return {'resources': resources}

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.13. 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

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

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

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

Approving the certificate signing requests for your machines

When you add machines to a cluster, two pending certificate signing requests (CSRs) are generated for each machine that you added. You must confirm that these CSRs are approved or, if necessary, approve them yourself. The client requests must be approved first, followed by the server requests.

Prerequisites

  • You added machines to your cluster.

Procedure

  1. Confirm that the cluster recognizes the machines:

    1. $ oc get nodes

    Example output

    1. NAME STATUS ROLES AGE VERSION
    2. master-0 Ready master 63m v1.26.0
    3. master-1 Ready master 63m v1.26.0
    4. master-2 Ready master 64m v1.26.0

    The output lists all of the machines that you created.

    The preceding output might not include the compute nodes, also known as worker nodes, until some CSRs are approved.

  2. Review the pending CSRs and ensure that you see the client requests with the Pending or Approved status for each machine that you added to the cluster:

    1. $ oc get csr

    Example output

    1. NAME AGE REQUESTOR CONDITION
    2. csr-8b2br 15m system:serviceaccount:openshift-machine-config-operator:node-bootstrapper Pending
    3. csr-8vnps 15m system:serviceaccount:openshift-machine-config-operator:node-bootstrapper Pending
    4. ...

    In this example, two machines are joining the cluster. You might see more approved CSRs in the list.

  3. If the CSRs were not approved, after all of the pending CSRs for the machines you added are in Pending status, approve the CSRs for your cluster machines:

    Because the CSRs rotate automatically, approve your CSRs within an hour of adding the machines to the cluster. If you do not approve them within an hour, the certificates will rotate, and more than two certificates will be present for each node. You must approve all of these certificates. After the client CSR is approved, the Kubelet creates a secondary CSR for the serving certificate, which requires manual approval. Then, subsequent serving certificate renewal requests are automatically approved by the machine-approver if the Kubelet requests a new certificate with identical parameters.

    For clusters running on platforms that are not machine API enabled, such as bare metal and other user-provisioned infrastructure, you must implement a method of automatically approving the kubelet serving certificate requests (CSRs). If a request is not approved, then the oc exec, oc rsh, and oc logs commands cannot succeed, because a serving certificate is required when the API server connects to the kubelet. Any operation that contacts the Kubelet endpoint requires this certificate approval to be in place. The method must watch for new CSRs, confirm that the CSR was submitted by the node-bootstrapper service account in the system:node or system:admin groups, and confirm the identity of the node.

    • To approve them individually, run the following command for each valid CSR:

      1. $ oc adm certificate approve <csr_name> (1)
      1<csr_name> is the name of a CSR from the list of current CSRs.
    • To approve all pending CSRs, run the following command:

      1. $ oc get csr -o go-template='{{range .items}}{{if not .status}}{{.metadata.name}}{{"\n"}}{{end}}{{end}}' | xargs --no-run-if-empty oc adm certificate approve

      Some Operators might not become available until some CSRs are approved.

  4. Now that your client requests are approved, you must review the server requests for each machine that you added to the cluster:

    1. $ oc get csr

    Example output

    1. NAME AGE REQUESTOR CONDITION
    2. csr-bfd72 5m26s system:node:ip-10-0-50-126.us-east-2.compute.internal Pending
    3. csr-c57lv 5m26s system:node:ip-10-0-95-157.us-east-2.compute.internal Pending
    4. ...
  5. If the remaining CSRs are not approved, and are in the Pending status, approve the CSRs for your cluster machines:

    • To approve them individually, run the following command for each valid CSR:

      1. $ oc adm certificate approve <csr_name> (1)
      1<csr_name> is the name of a CSR from the list of current CSRs.
    • To approve all pending CSRs, run the following command:

      1. $ oc get csr -o go-template='{{range .items}}{{if not .status}}{{.metadata.name}}{{"\n"}}{{end}}{{end}}' | xargs oc adm certificate approve
  6. After all client and server CSRs have been approved, the machines have the Ready status. Verify this by running the following command:

    1. $ oc get nodes

    Example output

    1. NAME STATUS ROLES AGE VERSION
    2. master-0 Ready master 73m v1.26.0
    3. master-1 Ready master 73m v1.26.0
    4. master-2 Ready master 74m v1.26.0
    5. worker-0 Ready worker 11m v1.26.0
    6. worker-1 Ready worker 11m v1.26.0

    It can take a few minutes after approval of the server CSRs for the machines to transition to the Ready status.

Additional information

Adding the ingress DNS records

DNS zone configuration is removed when creating Kubernetes manifests and generating Ignition configs. You must manually create DNS records that point at the ingress load balancer. You can create either a wildcard *.apps.{baseDomain}. or specific records. You can use A, CNAME, and other records per your requirements.

Prerequisites

  • Configure a GCP account.

  • Remove the DNS Zone configuration when creating Kubernetes manifests and generating Ignition configs.

  • Create and configure a VPC and associated subnets in GCP.

  • Create and configure networking and load balancers in GCP.

  • Create control plane and compute roles.

  • Create the bootstrap machine.

  • Create the control plane machines.

  • Create the worker machines.

Procedure

  1. Wait for the Ingress router to create a load balancer and populate the EXTERNAL-IP field:

    1. $ oc -n openshift-ingress get service router-default

    Example output

    1. NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
    2. router-default LoadBalancer 172.30.18.154 35.233.157.184 80:32288/TCP,443:31215/TCP 98
  2. Add the A record to your zones:

    • To use A records:

      1. Export the variable for the router IP address:

        1. $ export ROUTER_IP=`oc -n openshift-ingress get service router-default --no-headers | awk '{print $4}'`
      2. Add the A record to the private zones:

        1. $ if [ -f transaction.yaml ]; then rm transaction.yaml; fi
        2. $ gcloud dns record-sets transaction start --zone ${INFRA_ID}-private-zone --project ${HOST_PROJECT} --account ${HOST_PROJECT_ACCOUNT}
        3. $ gcloud dns record-sets transaction add ${ROUTER_IP} --name \*.apps.${CLUSTER_NAME}.${BASE_DOMAIN}. --ttl 300 --type A --zone ${INFRA_ID}-private-zone --project ${HOST_PROJECT} --account ${HOST_PROJECT_ACCOUNT}
        4. $ gcloud dns record-sets transaction execute --zone ${INFRA_ID}-private-zone --project ${HOST_PROJECT} --account ${HOST_PROJECT_ACCOUNT}
      3. For an external cluster, also add the A record to the public zones:

        1. $ if [ -f transaction.yaml ]; then rm transaction.yaml; fi
        2. $ gcloud dns record-sets transaction start --zone ${BASE_DOMAIN_ZONE_NAME} --project ${HOST_PROJECT} --account ${HOST_PROJECT_ACCOUNT}
        3. $ gcloud dns record-sets transaction add ${ROUTER_IP} --name \*.apps.${CLUSTER_NAME}.${BASE_DOMAIN}. --ttl 300 --type A --zone ${BASE_DOMAIN_ZONE_NAME} --project ${HOST_PROJECT} --account ${HOST_PROJECT_ACCOUNT}
        4. $ gcloud dns record-sets transaction execute --zone ${BASE_DOMAIN_ZONE_NAME} --project ${HOST_PROJECT} --account ${HOST_PROJECT_ACCOUNT}
    • To add explicit domains instead of using a wildcard, create entries for each of the cluster’s current routes:

      1. $ oc get --all-namespaces -o jsonpath='{range .items[*]}{range .status.ingress[*]}{.host}{"\n"}{end}{end}' routes

      Example output

      1. oauth-openshift.apps.your.cluster.domain.example.com
      2. console-openshift-console.apps.your.cluster.domain.example.com
      3. downloads-openshift-console.apps.your.cluster.domain.example.com
      4. alertmanager-main-openshift-monitoring.apps.your.cluster.domain.example.com
      5. prometheus-k8s-openshift-monitoring.apps.your.cluster.domain.example.com

Adding ingress firewall rules

The cluster requires several firewall rules. If you do not use a shared VPC, these rules are created by the Ingress Controller via the GCP cloud provider. When you use a shared VPC, you can either create cluster-wide firewall rules for all services now or create each rule based on events, when the cluster requests access. By creating each rule when the cluster requests access, you know exactly which firewall rules are required. By creating cluster-wide firewall rules, you can apply the same rule set across multiple clusters.

If you choose to create each rule based on events, you must create firewall rules after you provision the cluster and during the life of the cluster when the console notifies you that rules are missing. Events that are similar to the following event are displayed, and you must add the firewall rules that are required:

  1. $ oc get events -n openshift-ingress --field-selector="reason=LoadBalancerManualChange"

Example output

  1. Firewall change required by security admin: `gcloud compute firewall-rules create k8s-fw-a26e631036a3f46cba28f8df67266d55 --network example-network --description "{\"kubernetes.io/service-name\":\"openshift-ingress/router-default\", \"kubernetes.io/service-ip\":\"35.237.236.234\"}\" --allow tcp:443,tcp:80 --source-ranges 0.0.0.0/0 --target-tags exampl-fqzq7-master,exampl-fqzq7-worker --project example-project`

If you encounter issues when creating these rule-based events, you can configure the cluster-wide firewall rules while your cluster is running.

Creating cluster-wide firewall rules for a shared VPC in GCP

You can create cluster-wide firewall rules to allow the access that the OKD cluster requires.

If you do not choose to create firewall rules based on cluster events, you must create cluster-wide firewall rules.

Prerequisites

  • You exported the variables that the Deployment Manager templates require to deploy your cluster.

  • You created the networking and load balancing components in GCP that your cluster requires.

Procedure

  1. Add a single firewall rule to allow the Google Cloud Engine health checks to access all of the services. This rule enables the ingress load balancers to determine the health status of their instances.

    1. $ gcloud compute firewall-rules create --allow='tcp:30000-32767,udp:30000-32767' --network="${CLUSTER_NETWORK}" --source-ranges='130.211.0.0/22,35.191.0.0/16,209.85.152.0/22,209.85.204.0/22' --target-tags="${INFRA_ID}-master,${INFRA_ID}-worker" ${INFRA_ID}-ingress-hc --account=${HOST_PROJECT_ACCOUNT} --project=${HOST_PROJECT}
  2. Add a single firewall rule to allow access to all cluster services:

    • For an external cluster:

      1. $ gcloud compute firewall-rules create --allow='tcp:80,tcp:443' --network="${CLUSTER_NETWORK}" --source-ranges="0.0.0.0/0" --target-tags="${INFRA_ID}-master,${INFRA_ID}-worker" ${INFRA_ID}-ingress --account=${HOST_PROJECT_ACCOUNT} --project=${HOST_PROJECT}
    • For a private cluster:

      1. $ gcloud compute firewall-rules create --allow='tcp:80,tcp:443' --network="${CLUSTER_NETWORK}" --source-ranges=${NETWORK_CIDR} --target-tags="${INFRA_ID}-master,${INFRA_ID}-worker" ${INFRA_ID}-ingress --account=${HOST_PROJECT_ACCOUNT} --project=${HOST_PROJECT}

    Because this rule only allows traffic on TCP ports 80 and 443, ensure that you add all the ports that your services use.

Completing a GCP installation on user-provisioned infrastructure

After you start the OKD installation on Google Cloud Platform (GCP) user-provisioned infrastructure, you can monitor the cluster events until the cluster is ready.

Prerequisites

  • Deploy the bootstrap machine for an OKD cluster on user-provisioned GCP infrastructure.

  • Install the oc CLI and log in.

Procedure

  1. Complete the cluster installation:

    1. $ ./openshift-install --dir <installation_directory> wait-for install-complete (1)

    Example output

    1. INFO Waiting up to 30m0s for the cluster to initialize...
    1For <installation_directory>, specify the path to the directory that you stored the installation files in.
    • 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.

  2. Observe the running state of your cluster.

    1. Run the following command to view the current cluster version and status:

      1. $ oc get clusterversion

      Example output

      1. NAME VERSION AVAILABLE PROGRESSING SINCE STATUS
      2. version False True 24m Working towards 4.5.4: 99% complete
    2. Run the following command to view the Operators managed on the control plane by the Cluster Version Operator (CVO):

      1. $ oc get clusteroperators

      Example output

      1. NAME VERSION AVAILABLE PROGRESSING DEGRADED SINCE
      2. authentication 4.5.4 True False False 7m56s
      3. cloud-credential 4.5.4 True False False 31m
      4. cluster-autoscaler 4.5.4 True False False 16m
      5. console 4.5.4 True False False 10m
      6. csi-snapshot-controller 4.5.4 True False False 16m
      7. dns 4.5.4 True False False 22m
      8. etcd 4.5.4 False False False 25s
      9. image-registry 4.5.4 True False False 16m
      10. ingress 4.5.4 True False False 16m
      11. insights 4.5.4 True False False 17m
      12. kube-apiserver 4.5.4 True False False 19m
      13. kube-controller-manager 4.5.4 True False False 20m
      14. kube-scheduler 4.5.4 True False False 20m
      15. kube-storage-version-migrator 4.5.4 True False False 16m
      16. machine-api 4.5.4 True False False 22m
      17. machine-config 4.5.4 True False False 22m
      18. marketplace 4.5.4 True False False 16m
      19. monitoring 4.5.4 True False False 10m
      20. network 4.5.4 True False False 23m
      21. node-tuning 4.5.4 True False False 23m
      22. openshift-apiserver 4.5.4 True False False 17m
      23. openshift-controller-manager 4.5.4 True False False 15m
      24. openshift-samples 4.5.4 True False False 16m
      25. operator-lifecycle-manager 4.5.4 True False False 22m
      26. operator-lifecycle-manager-catalog 4.5.4 True False False 22m
      27. operator-lifecycle-manager-packageserver 4.5.4 True False False 18m
      28. service-ca 4.5.4 True False False 23m
      29. service-catalog-apiserver 4.5.4 True False False 23m
      30. service-catalog-controller-manager 4.5.4 True False False 23m
      31. storage 4.5.4 True False False 17m
    3. Run the following command to view your cluster pods:

      1. $ oc get pods --all-namespaces

      Example output

      1. NAMESPACE NAME READY STATUS RESTARTS AGE
      2. kube-system etcd-member-ip-10-0-3-111.us-east-2.compute.internal 1/1 Running 0 35m
      3. kube-system etcd-member-ip-10-0-3-239.us-east-2.compute.internal 1/1 Running 0 37m
      4. kube-system etcd-member-ip-10-0-3-24.us-east-2.compute.internal 1/1 Running 0 35m
      5. openshift-apiserver-operator openshift-apiserver-operator-6d6674f4f4-h7t2t 1/1 Running 1 37m
      6. openshift-apiserver apiserver-fm48r 1/1 Running 0 30m
      7. openshift-apiserver apiserver-fxkvv 1/1 Running 0 29m
      8. openshift-apiserver apiserver-q85nm 1/1 Running 0 29m
      9. ...
      10. openshift-service-ca-operator openshift-service-ca-operator-66ff6dc6cd-9r257 1/1 Running 0 37m
      11. openshift-service-ca apiservice-cabundle-injector-695b6bcbc-cl5hm 1/1 Running 0 35m
      12. openshift-service-ca configmap-cabundle-injector-8498544d7-25qn6 1/1 Running 0 35m
      13. openshift-service-ca service-serving-cert-signer-6445fc9c6-wqdqn 1/1 Running 0 35m
      14. openshift-service-catalog-apiserver-operator openshift-service-catalog-apiserver-operator-549f44668b-b5q2w 1/1 Running 0 32m
      15. openshift-service-catalog-controller-manager-operator openshift-service-catalog-controller-manager-operator-b78cr2lnm 1/1 Running 0 31m

    When the current cluster version is AVAILABLE, the installation is complete.

Additional resources

Next steps