RedHatGov / terraform-packet-openshift

Resources and artifacts for OCP 4 UPI on Packet using Terraform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Terraform CI

OpenShift via Terraform on Packet

This collection of modules will deploy will deploy a bare metal OpenShift consisting of (1) ephemeral bootstrap node, (3) control plane nodes, and a user-configured count of worker nodes1 on Packet. DNS records are automatically configured using Cloudflare.

Install Terraform

Terraform is just a single binary. Visit their download page, choose your operating system, make the binary executable, and move it into your path.

Here is an example for macOS:

curl -LO https://releases.hashicorp.com/terraform/0.12.25/terraform_0.12.26_darwin_amd64.zip
unzip terraform_0.12.25_darwin_amd64.zip
chmod +x terraform
sudo mv terraform /usr/local/bin/

Example for Linux:

wget https://releases.hashicorp.com/terraform/0.12.26/terraform_0.12.26_linux_amd64.zip
unzip terraform_0.12.26_linux_amd64.zip
sudo install terraform /usr/local/bin/

Additional requirements

local-exec provisioners require the use of:

  • curl
  • jq

To install jq on RHEL/CentOS:

wget https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
sudo install jq-linux64 /usr/local/bin/jq

To install jq on Debian/Ubuntu:

sudo apt-get install jq

Download this project

To download this project, run the following command:

git clone https://github.com/RedHatSI/terraform-packet-openshift.git
cd terraform-packet-openshift

Usage

  1. Follow this to configure your Packet Public Cloud project and collect required parameters.

  2. Follow this to configure your Cloudflare account and collect required parameters.

  3. Obtain an OpenShift Cluster Manager API Token for pullSecret generation.

  4. Configure TF_VARs applicable to your Packet project, Cloudflare zone, and OpenShift API Token:

    export TF_VAR_project_id="kajs886-l59-8488-19910kj"
    export TF_VAR_auth_token="lka6702KAmVAP8957Abny01051"
    
    export TF_VAR_cf_email="yourcfmail@domain.com"
    export TF_VAR_cf_api_key="21df29762169c002ca656"
    export TF_VAR_cf_zone_id="706767511sf7377900"
    
    export TF_VAR_cluster_basedomain="domain.com"
    export TF_VAR_ocp_cluster_manager_token="eyJhbGc...d8Agva"
  5. Initialize and validate terraform:

    terraform init
    terraform validate
  6. Provision all resources and start the installation. This process takes between 30 and 50 minutes:

    terraform apply
  7. Cleanup the boostrap node once provisioning and installation is complete by permanently (recommended) or temporarily setting count_bootstrap=0

    terraform apply -var="count_bootstrap=0"

    If you need to obtain your kubeadmin credentials at a later time:

    terraform output
    

Experimental Statement

This repository is Experimental!


1 As of OpenShift Container Platform 4.5 you can deploy three-node clusters on bare metal. Setting count_compute=0 will support deployment of a 3-node cluster.

About

Resources and artifacts for OCP 4 UPI on Packet using Terraform

License:Apache License 2.0


Languages

Language:HCL 45.1%Language:Shell 44.7%Language:Smarty 10.2%