Last active
March 7, 2018 14:07
-
-
Save devigned/2f12cd632a1e823f52b66e992203ea0d to your computer and use it in GitHub Desktop.
Kubernetes commands for deploying Rails todo from private registry
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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