kubernetes/Intermediate/Multicontainer-Workshop/readme.md
This is an Example for Multi Container Pod Simple tutorial to demonstrate the concept of packaging multiple containers into a single pod.
Web Pod has a Python Flask container and a Redis container DB Pod has a MySQL container When data is retrieved through the Python REST API, it first checks within Redis cache before accessing MySQL Each time data is fetched from MySQL, it gets cached in the Redis container of the same Pod as the Python Flask container When the additional Web Pods are launched manually or through a Replica Set, co-located pairs of Python Flask and Redis containers are scheduled together
Make sure that you have access to a Kubernetes cluster.
Deploy both the yaml files in the repository and check the pods and service created
kubectl get pods
NAME READY STATUS RESTARTS AGE
web-deployment-59f55d55cc-dr8sg 2/2 Running 0 10h
web-deployment-59f55d55cc-gs6q7 2/2 Running 0 10h
web-deployment-59f55d55cc-kgrwn 2/2 Running 0 10h
kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
web NodePort 10.111.115.205 <none> 80:30363/TCP 22h
kubectl get nodes
export NODE_IP=<NODE_IP>
export NODE_PORT=<NODE_PORT>
curl -i -H "Content-Type: application/json" -X POST -d '{"uid": "1", "user":"Saiyam Pathak"}' http://$NODE_IP:$NODE_PORT/users/add
curl -i -H "Content-Type: application/json" -X POST -d '{"uid": "2", "user":"Sangam Birdar"}' http://$NODE_IP:$NODE_PORT/users/add
curl -i -H "Content-Type: application/json" -X POST -d '{"uid": "3", "user":"Ajeet Singh Rana"}' http://$NODE_IP:$NODE_PORT/users/add
curl http://$NODE_IP:$NODE_PORT/users/1
curl http://$NODE_IP:$NODE_PORT/users/1
maintainer - Saiyam Pathak ([email protected]) | @saiyampathak | https://medium.com/@saiyampathak Sangam Birdar