Skip to content

Instantly share code, notes, and snippets.

@sjlu
Created October 19, 2015 16:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sjlu/004fdfd247b5185fa203 to your computer and use it in GitHub Desktop.
Save sjlu/004fdfd247b5185fa203 to your computer and use it in GitHub Desktop.
Kubernetes and Google Container Engine cheatsheet

Setting project:

gcloud config set project tidy-bindery-110323

Creating a cluster:

gcloud container clusters create web --num-nodes=1 --machine-type=g1-small --zone=us-east1-b

Running a service:

kubectl run web --image=gcr.io/tidy-bindery-110323/web --port=8080

To expose the service through a load balancer:

kubectl expose rc web --create-external-load-balancer=true --port=80 --target-port=8080

Get IPs

kubectl get services web

To delete the load balancer:

kubectl delete services -l run=web

Updating a replication controller:

kubectl rolling-update web --image=web:6f7b0aff285f792f4757d703b54ddf34f4bede87
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment