Kubernetes Quick Dive
Launch vote application with kubernetes. (simiar to docker run command)
kubectl run vote --image=schoolofdevops/vote
kubectl get pods
Publish the application (similar to using -P for port mapping)
kubectl expose deployment vote --type=NodePort --port 80
kubectl get svc
Scale the vote app to run 4 instances.
kubectl scale --replicas=4 deployment/vote
kubectl get pods
Connect to the app, refresh the page to see it load balancing. Also try to vote and observe what happens.
Setup additional apps
Now lets launch rest of the apps.
kubectl run redis --image=redis:alpine
kubectl expose deployment redis --port 6379
kubectl run worker --image=schoolofdevops/worker
kubectl run db --image=postgres:9.4
kubectl expose deployment db --port 5432
kubectl run result --image=schoolofdevops/vote-result
kubectl expose deployment result --type=NodePort --port 80
Cleaing up
Once you are done observing, you could delete it with the following commands,
kubectl delete deploy db redis vote worker result
kubectl delete svc db redis results vote