Skip to content

Instantly share code, notes, and snippets.

@timoyuen
Forked from devigned/rails-todo-hab-kube.sh
Created March 7, 2018 14:07
Show Gist options
  • Save timoyuen/c2dbb6f394c5f5eaec7eb4c62a664c1f to your computer and use it in GitHub Desktop.
Save timoyuen/c2dbb6f394c5f5eaec7eb4c62a664c1f to your computer and use it in GitHub Desktop.
Kubernetes commands for deploying Rails todo from private registry
# fetch the hostname of the Azure Container Registry
registry=$(az acr list -g habitat-k8s --query "[?starts_with(name, 'habk8s')] | [0].loginServer" -o tsv)
# run the image sourced from the private repository, and expose port 3000
kubectl run rails-todo --image=${registry}/rails-todo:latest --port 3000
# watch our pod provision
watch kubectl get po
# once the pod is running exit watch
# expose the deployment to the world on port 80
kubectl expose deployment rails-todo --port=80 --target-port=3000 --type=LoadBalancer
# wait for the Public IP to be exposed
watch kubectl get services
# once the service has a public IP, exit watch, and open a browser to the IP and see the app
# scale up to 5 instances
kubectl scale --replicas=5 deployments/rails-todo
watch kubectl get po
# once the containers have started, exit watch, you are now running 5 instances of the app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment