Install Openshift 4 di GCP

Berikut cara install Openshift 4.4 di Google Cloud Platfrom

1. Initial setup untuk gcloud

$ gcloud init

$ gcloud config list
[compute]
region = us-central1
zone = us-central1-a
[core]
account = sample@example.com
disable_usage_reporting = True
project = [PROJECT_NAME]

2. Enable beberapa API yang dibutuhkan

$ gcloud services enable compute.googleapis.com --project [PROJECT_NAME]
$ gcloud services enable cloudapis.googleapis.com --project [PROJECT_NAME]
$ gcloud services enable cloudresourcemanager.googleapis.com --project [PROJECT_NAME]
$ gcloud services enable dns.googleapis.com --project [PROJECT_NAME]
$ gcloud services enable iamcredentials.googleapis.com --project [PROJECT_NAME]
$ gcloud services enable iam.googleapis.com --project [PROJECT_NAME]
$ gcloud services enable servicemanagement.googleapis.com --project [PROJECT_NAME]
$ gcloud services enable serviceusage.googleapis.com --project [PROJECT_NAME]
$ gcloud services enable storage-api.googleapis.com --project [PROJECT_NAME]
$ gcloud services enable storage-component.googleapis.com --project [PROJECT_NAME]

3. Buat service account dan assign rolenya

$ gcloud iam service-accounts create openshift-sa \
--description="sa-for-openshift" \
--display-name="openshift-sa"

$ gcloud iam service-accounts keys create ~/.gcp/osServiceAccount.json \
--iam-account openshift-sa@[PROJECT_NAME].iam.gserviceaccount.com

$ gcloud projects add-iam-policy-binding [PROJECT_NAME] \
--member "serviceAccount:openshift-sa@[PROJECT_NAME].iam.gserviceaccount.com" --role "roles/owner"

5. Download openshift-install dan pull-secret dari link berikut

https://cloud.redhat.com/openshift/install/gcp/installer-provisioned

6. Deploy

$ tar -xvf openshift-install-linux.tar.gz
$ mkdir ocp4
$ cp pull-secret.txt ocp4/
$ ./openshift-install create install-config --dir=./ocp4/
$ ./openshift-install create cluster --dir=./ocp4/ --log-level=info
INFO Credentials loaded from file "~/.gcp/osServiceAccount.json"
INFO Consuming Install Config from target directory
INFO Creating infrastructure resources...
INFO Waiting up to 20m0s for the Kubernetes API at https://api.[CLUSTER_NAME].[FQDN]:6443...
INFO API v1.17.1+912792b up
INFO Waiting up to 40m0s for bootstrapping to complete...
INFO Destroying the bootstrap resources...
INFO Waiting up to 30m0s for the cluster at https://api.[CLUSTER_NAME].[FQDN]:6443 to initialize...
INFO Waiting up to 10m0s for the openshift-console route to be created...
INFO Install complete!
INFO To access the cluster as the system:admin user when using 'oc', run 'export KUBECONFIG=~/ocp4/auth/kubeconfig'
INFO Access the OpenShift web-console here: https://console-openshift-console.apps.[CLUSTER_NAME].[FQDN] 
INFO Login to the console with user: kubeadmin, password: [PASSWORD]

Done