Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save trungng1992/fbef2f0ab640f2566bb8f935657011dc to your computer and use it in GitHub Desktop.
Save trungng1992/fbef2f0ab640f2566bb8f935657011dc to your computer and use it in GitHub Desktop.
# 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