Images pull directly from dockersamples/ repo
- Redis - frontend voting, database redis
- Voting - frontend voting, python app on port 5000:80
- DB - backend database, postgres, default username & password
- Result - backend dashboard, express/nodejs app on port 5001:80
- Worker - backend processing, C# app need redis & DB
docker stack deploy STACK-NAME --compose-file=docker-stack.yml
- replace STACK-NAME with voting-app maybe
- Check stack
docker stack ls
- Check services
docker service ls
docker compose up -d
- Will remove obsolete links later
- Compose v3, old one might use
docker-compose up
- Check
docker ps -a
- Apps' name were hard coded inside source codes e.g Redis(host="redis"), OpeRedisConnection("redis") (no3 of 12factor)
- We will use Service name exactly like their hard coded in code based, except Worker no service/user consume this
- DB, Redis don't need to expose to external (least privilege), ClusterIP
- Expose Voting, Result, NodePort
Running pods
kubectl create -f pod/FILENAME.yaml
Running services
kubectl create -f service/FILENAME.yaml
kubectl get pod,svc
to check running services and pods (all
could do the job)
After running all the files, we should have 4 services(2 Nodes, 2 Clusters), and 5 pods
- We don't need to access worker pod
- First we will exposse NodePort to user facing service like voting & result
- We will have ClusterIP to make a stable connection, redis and db services
- Later we will change NodePort to LoadBalancer to host on aws, gcp or azure
Running deploy
kubectl create -f deployment/FILENAME.yaml
Running services
kubectl create -f service/FILENAME.yaml
kubectl get deploy,svc
to check running services and deployments (all
could do the job)
After running all the files, we should have 4 services(2 Nodes, 2 Clusters), and 5 deploy with single replica