# IBM OpenSource Project RoboShop with Kubernetes


In this Blog you will learn about Namespace , Cluster , ConfigMap , Secrets , Labels , annotations , pods , Deployment , replicaset , Selectors , emptyDir ,  
manifest files , Services , Cluster IP , NodePort , LoadBalancer , Networking.

So here what ever the request comes to the LoadBalancer at port 80 (http) will be forwarded to the any node at port 31240  
and the node will forward the request to the frontend service and frontend service will forward to the pods attached to the service.

![](https://cdn.hashnode.com/uploads/covers/66d950bc53b6fbeba2093f57/0c79b2d4-2e92-42f7-88c1-6c4d186725a5.png align="center")

If any version change in the Docker Image then we can simply modify the manifest.yml file and do the kubectl apply -f Frontend/manifest.yml  
Then pods will get the new image and kubernetes performs the rolling deployment.

Here we opened the port 8080 for the nginx pod , because if we run the container with the non-root user then we can't open the system ports  
the system port range is (0-1024), but service port can be anything so we set for port 80.

Generally Kubenetes is for the stateless applications , not for the statefull applications means it is not good to keep the databases in the k8s  
but in fewer situations we can run the DB in K8s like Redis for cache purpose. But it is not recommended to keep the Prod DB.

The entire k8s cluster is ephemeral (temporary) So where can we store the pod logs then ? So we create sidecar container in the each pod so that  
that sidecar container will access the application pods logs and send it to the ELK.

These concept comes under Volumes , In the current manifest file of Mysql i have used the emptyDir volume ignore now we will discuss in the next blog.

Commands i used commonly:  
eksctl create cluster --config-file=manifest.yml  
eksctl delete cluster --config-file=manifest.yml

kubens roboshop  
kubectl get pods  
kubectl get svc  
kubectl get pods -o wide  
kubectl exec -it <Pod\_Name> -- bash  
kubectl exec -it <Pod\_Name> -- sh  
kubectl apply -f Catalogue/manifest.yml

kubectl describe pod <Pod\_Name>  
kubectl logs <Pod\_Name>  
kubectl describe svc <Service\_Name>  
kubectl get rs  
watch kubectl get pods => refreshes every 2 sec  
kubectl get nodes

telnet mysql 3306  
telnet mongodb 27017  
telnet redis 6379  
telnet rabbitmq 5672  
telnet catalogue 8080

echo "vijay' | base64 => encoding  
echo "dmlqYXkK" | base64 -d => decoding

Here i have created the cluster nodes with type SPOT , Means aws will charge you with the minimal amount for that spot instances and aws can take back the instances at any time, So it is not recommended to use spot instances in the production env's, Here i have used for the learning purpose alone.

In the next blog we will learn about the Volumes , emptyDir , hostPath , PV(Persistent Volume) , PVC(Persistent Volume Claim) , Statefullset , Daemonset , StorageClass ,  
headless service , sidecar containers.

Project Images:

![](https://cdn.hashnode.com/uploads/covers/66d950bc53b6fbeba2093f57/cdce72c9-3ef3-4227-a417-511af3f01602.png align="center")

![](https://cdn.hashnode.com/uploads/covers/66d950bc53b6fbeba2093f57/f5c0e2c8-c0bc-40a4-89a1-a104e4616dec.png align="center")

![](https://cdn.hashnode.com/uploads/covers/66d950bc53b6fbeba2093f57/191b62e5-e1e9-45af-ac9b-ccab18742379.png align="center")

![](https://cdn.hashnode.com/uploads/covers/66d950bc53b6fbeba2093f57/b43f1de3-30cb-4f8b-b9b4-9f5618578b18.png align="center")

![](https://cdn.hashnode.com/uploads/covers/66d950bc53b6fbeba2093f57/e12c45fd-a1f2-4c3f-8488-a66861c76139.png align="center")

Thank You :)
