Last active
October 19, 2021 03:00
-
-
Save trungng1992/fbef2f0ab640f2566bb8f935657011dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Step 1 | |
Run google cloud shell | |
$ gcloud config set compute/zone us-central1-a | |
On google console -> Navigation menu -> Kubernetes Engine -> Cluster | |
Chose create cluster with gke standard. | |
On name field, fill `echo-cluster` | |
On zone field, choose `us-central1-a` | |
Click `create` | |
# Step 2: Down cloud source code and build container | |
In google shell: | |
$ gsutil cp gs://$DEVSHELL_PROJECT_ID/echo-web.tar.gz . | |
$ tar -zxvf echo-web.tar.gz | |
$ cd echo-web | |
$ gcloud builds submit --tag gcr.io/$DEVSHELL_PROJECT_ID/echo-app:v1 . | |
# Step 3: Deploy a application on k8s | |
In google shell | |
$ gcloud container clusters get-credentials echo-cluster --zone us-central1-a --project $DEVSHELL_PROJECT_ID | |
$ kubectl create deployment echo-web --image=gcr.io/$DEVSHELL_PROJECT_ID/echo-app:v1 | |
# Step 4: Expose service | |
$ kubectl expose deployment echo-web --name=echo-app --port=80 --target-port=8000 --type=LoadBalancer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment