Skip to content

Instantly share code, notes, and snippets.

@nmicht
Created March 14, 2019 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nmicht/b4bf2758ee40ef1385bf12aabed4fb54 to your computer and use it in GitHub Desktop.
Save nmicht/b4bf2758ee40ef1385bf12aabed4fb54 to your computer and use it in GitHub Desktop.
Deploy Docker to GCloud

Create the cluste

gcloud container clusters create kaka-cluster --num-nodes=1

  • kaka-cluster: the name of the cluster

Run the docker (the workload)

kubectl run kaka-server --image=gcr.io/kaka-234500/dockerflask_docker-flask:latest --port 5000 --env="FLASK_APP=app/main.py" --env="PORT=5000" --env="HOST=0.0.0.0"

  • kaka-server: the name of the workload
  • image: the name of the image on the hub
  • port: the exposed by the docker
  • env: the environment variables

Expose to the internet

kubectl expose deployment kaka-server --type=LoadBalancer --port 80 --target-port 5000

  • kaka-server: the name of the workload
  • port: the exposed port
  • target-port: the exposed by the docker

Get the IP

kubectl get service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment