Provisioning Cluster Infrastructure Using Terraform

Learn how to provision OCI infrastructure for the Red Hat OpenShift Container Platform using a Terraform script with the Agent-based installer.

To automatically provision infrastructure with Terraform, you use the Resource Manager service. In Resource Manager, you first create a stack, which is a configuration based on the Terraform script contained in the create-cluster-vX.X.X.zip file. Then, to provision the resources, you create an Apply job, which processes the stack and creates the infrastructure resources.

See the following topics for more information:

See Terraform Defined Resources for OpenShift for a list of the resources created by the create-cluster-vX.X.X.zip file used by Resource Manager.

  1. Open the navigation menu  and select Developer Services. Under Resource Manager, select Stacks.
  2. Select Create stack
  3. In the Stack information section, select the My configuration. Select .Zip file and upload the create-cluster-vX.X.X.zip file. After specifying the configuration source, select Next.
  4. In the Configure variables page, complete the following fields:
    Section Field Value
    OpenShift Cluster Configuration Compartment Select Compartment from the dropdown menu.
    Cluster Name Enter the cluster_name value. Use the same cluster name that you entered during the creation of the ISO image in the Red Hat Hybrid Cloud Console.
    Installation Method Select Agent-based.
    Create OpenShift Image and Instances This option must be disabled (remove the checkmark if one is present).
    Networking Configuration Enable Private DNS Optionally, you can set the DNS zone to private by checking the box for this option. For a private DNS zone, you must configure your local /etc/hosts file to reach the cluster.
    Zone DNS Specify the DNS name server that stores DNS records for a zone, such as openshift-demo.devcluster.openshift.com This is the same value as the Base domain entered in the Red Hat Hybrid Cloud Console during the creation of the ISO image.
    VCN DNS Label A DNS label for the VCN, used with the VNIC's host name and subnet's DNS label to form a fully qualified domain name (FQDN) for each VNIC within the subnet.
    VCN CIDR The IPv4 CIDR blocks for the VCN of the OpenShift cluster.
    Public Subnet CIDR The IPv4 CIDR blocks for the public subnet of the OpenShift cluster.
    Private Subnet CIDR The IPv4 CIDR blocks for the private subnet of the OpenShift cluster.
    Secondary Private Subnet CIDR (optional) The IPv4 CIDR blocks for the private subnet of the OpenShift bare metal clusters.
    Rendezvous IP The IP used to bootstrap the cluster using the Agent-based Installer. This value must match the rendezvousIP value specified in the agent-config.yaml file. For bare metal instances, this IP address must be within the secondary private subnet CIDR
    Load Balancer Maximum Bandwidth Bandwidth value in Mbps that sets the maximum bandwidth (ingress plus egress) that the load balancer can achieve.
    Load Balancer Minimum Bandwidth Bandwidth value in Mbps that sets the total pre-provisioned bandwidth (ingress plus egress).
    Tagging Configuration Use Existing Tagging Resources Select this option to use an existing OCI tag namespace and it's defined tags.
    Tag namespace (optional) Name of tag namespace to create or reuse for tagging OCI resources used by the OpenShift cluster.
    Tag namespace compartment OCID The OCID of the compartment that contains the tag namespace.
    Tag Consistency Wait Duration The number of seconds the creation operation waits before creating tagged resources. The wait period lets new tags propagate so that they can be applied to resources.
  5. Select Next and review the Stack information and Variables.
  6. Select Create to create the stack. The Console redirects to the stack details page for the new stack.
  7. On the stack details page, select Apply to create an apply job and provision the infrastructure for the cluster. After running an apply job, get the job's details to check its status. Succeeded (SUCCEEDED) indicates that the job has completed. The apply stack job takes up to 5 minutes. When it completes, all the OpenShift resources except the ISO image and the Compute instances are created.
  8. In the list of Jobs, select the job for the stack creation. The Job details page is displayed in the Console. If you don't see the list of jobs, select Jobs under the Resources section to display this section of the page.
  9. Select Outputs under the Resources section to see the list of outputs for the job.
  10. Select copy to copy the contents of the output to your machine's clipboard. Note: We recommend that you do not manually select and copy the text, as this can cause problems with indentation when you paste this output in the following step.
  11. Copy the output of the dynamic_custom_manifest into a file on your local machine for use later in the installation process.
  12. Create configuration files and a bootable ISO image for installing your cluster. See Creating configuration files for installing a cluster on OCI in the Red Hat Documentation for instructions. Return to this documentation after you create the configuration files and ISO image, then continue the installation.
  13. Upload the discovery ISO image file to a bucket in OCI Object Storage. See Putting Data into Object Storage if you need instructions.
  14. Create a pre-athenticated request for the ISO file in Object Storage. See Using Pre-Authenticated Requests if you need instructions. Copy the pre-authenticated request string to your clipboard.
  15. Return to the Resource Manager service and navigate to the stack details page for the stack you created to install OpenShift. Under Resources, select Variables.
  16. Select Edit variables.
  17. In the OpenShift Cluster Configuration section, enable the Create OpenShift Image and Instances option (put a check in the check box).
  18. In the Control Plane Node Configuration section, paste the the preauthenticated request string into the OpenShift Image Source URI field.
  19. Review the values in the Control Plane Node Configuration and Compute Node Configuration sections, and ensure that the Control Plane Node Count and Compute Node Count values match the values in the agent-config file. Select Next to review and save the changes.
  20. On the Stack details page, select Apply to run another apply job for the stack. This job takes up to 20 minutes to complete. The job creates the custom software image used by the Compute instances in the cluster, and it provisions the Compute instances. Once the compute instances are provisioned by the stack, the cluster installation begins automatically.
  21. Use the instructions in Verifying that your Agent-based cluster installation runs on OCI in the Red Hat documentation to verify that the cluster is running. This step is performed in the OpenShift Container Platform CLI.