Skip to content

Latest commit

 

History

History
104 lines (91 loc) · 3.75 KB

OpenshiftGCP.md

File metadata and controls

104 lines (91 loc) · 3.75 KB

Create an openshift cluster on GCP

  1. Login to openshift https://cloud.redhat.com/openshift/
  2. Press "Create Cluster" button--> Red Hat Openshift Container platform-->GCP--> Installer provision infrastructure
  3. Folow the instruction and download the binary for openshift-install and openshift-client, unzip them and register to the PATH environment var:

For macOS:

curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-install-mac.tar.gz
curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-mac.tar.gz

tar -xzf openshift-install-mac.tar.gz 
tar -xzf openshift-client-mac.tar.gz 

//Make binary executable
chmod +x ./openshift-install
chmod +x ./oc

//Move the binary into your PATH
sudo mv ./openshift-install /usr/local/bin/openshift-install
sudo mv ./oc /usr/local/bin/oc

//check install
openshift-install version
oc version

For Linux:

//Download binary
curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-install-linux.tar.gz
curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-linux.tar.gz

tar -xzf openshift-install-linux.tar.gz 
tar -xzf openshift-client-linux.tar.gz 

//Make binary executable
chmod +x ./openshift-install
chmod +x ./oc

//Move the binary into your PATH
sudo mv ./openshift-install /usr/local/bin/openshift-install
sudo mv ./oc /usr/local/bin/oc

//check install
openshift-install version
oc version
  1. The installer will use the default configuration, so set the PROJECT on the default configuration
gcloud auth application-default login
  1. Enable following api services:
gcloud services enable compute.googleapis.com
gcloud services enable cloudapis.googleapis.com 
gcloud services enable cloudresourcemanager.googleapis.com 
gcloud services enable dns.googleapis.com 
gcloud services enable iam.googleapis.com 
gcloud services enable iamcredentials.googleapis.com 
gcloud services enable servicemanagement.googleapis.com
gcloud services enable serviceusage.googleapis.com
gcloud services enable storage-api.googleapis.com 
gcloud services enable storage-component.googleapis.com
  1. Create a service account and attach it to the project:
gcloud iam service-accounts create open-shift-sa
gcloud projects add-iam-policy-bindings openshift-sandbox --member  "serviceAccount:[email protected]" --role "roles/owner"
  1. Set credentials:
mkdir -p ~/.gcp
gcloud iam service-accounts keys create ~/.gsp/osServiceAccount.json --iam-account [email protected] 
  1. Create a folder where the installation of the cluster will be saved
mkdir ~/oshift
  1. Make sure you have a DNS domain. Delegate a subdomain to google cloud
gcloud dns managed-zones openshift-domain

Add the server names from this command in the DNS provider zone configuration file

gcloud dns managed-zones describe openshift-domain

Check that the records match using this commands:

gcloud dns managed-zones describe openshift-domain
dig @8.8.8.8 mydomain.com NS +short
  1. Create the cluster. Follow the instruction from comand line.
 openshift-install create cluster --dir ~/oshift --log-level=debug
  1. Please do not delete the folder where the installation was made, in our case ~/oshift. If you delete this you will have to decommission manually the infrastructure from GCP.
  2. If you want to delete the cluster run this cmd to decommission infrastructure on GCP:
 openshift-install destroy cluster --dir ~/oshift --log-level=debug

To remove the cluster from Redhat list you have to go to Clusters menu, select the cluster, press Actions and choose Archive cluster option.