forked from collabnix/dockerlabs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Creating 2 Node GKE Cluster
20 lines (14 loc) · 2.24 KB
/
Creating 2 Node GKE Cluster
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Open https://console.cloud.google.com and login with your Admin account.
Activate Google Cloud Shell from the top right corner of your screen. [To know more about Google Cloud Shell visit:- https://cloud.google.com/shell/]
Run the following command to create a Gcloud Project:-
divyajeet@cloudshell:~$ gcloud projects create --name=My-GKE-Project
Press Y to accept the randomly generate project id from GCP and let the Gcloud do its magic.
Next associate your project to a billing account and to do that run the following command:-
gcloud beta billing projects link my-gke-project-XXXXXX --billing-account=0180C0-XXXXXX-XXXXXX [To know more about how to associate Project to billing account visit:- https://cloud.google.com/sdk/gcloud/reference/beta/billing/projects/link]
Now you are ready to deploy 2 node GKE cluster on GCP.
Disclaimer:- Following deployment is not recommended to be used in the Production environment, if you want to use do it on your own risk.
Run following command to create your 2 Node cluster [Note:- Change XXXXXX to the value visible in your GCP console]:-
gcloud beta container --project "main-project-XXXXXX" clusters create "my-gke-cluster" --zone "us-central1-a" --no-enable-basic-auth --cluster-version "1.13.10-gke.0" --machine-type "n1-standard-1" --image-type "COS" --disk-type "pd-standard" --disk-size "100" --scopes "https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/service.management.readonly","https://www.googleapis.com/auth/trace.append" --num-nodes "2" --enable-cloud-logging --enable-cloud-monitoring --enable-ip-alias --network "projects/main-project-XXXXXX/global/networks/default" --subnetwork "projects/main-project-XXXXXX/regions/us-central1/subnetworks/default" --default-max-pods-per-node "20" --addons HorizontalPodAutoscaling,HttpLoadBalancing --enable-autoupgrade --enable-autorepair --no-shielded-integrity-monitoring
Next you should connect your to GKE cluster to cloud shell by using following command:-
gcloud container clusters get-credentials my-gke-cluster --zone us-central1-a
Now you are ready to deploy your workload to newly created cluster.