Skip to content

Instantly share code, notes, and snippets.

@nmicht
Created Mar 14, 2019
Embed
What would you like to do?
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