- Use docker or any other containzeried platforms to create conatiners
- docker run -it -d port ....
- Kubernetes tells to use YAML files (called manifest files) instead of writing in command line
- Inside the manifest files we can define conatiner image-name, port, network, mount, volume and etc
- It is nothing but a running specification of docker container
- A pod can be singal or multiplye container
- We create multiple conatiner be'coz one container is dependent of other container (sidecar container)
- Use case is service mesh, Both the conatiners have same volume same network localhost
- Pod is somewhere similar to the container but it is doing nothing just a yaml specification of the container
- Pod can not do AUTOHEALING & AUTOSCALING
- Can we use pod to deployment conatiner or application, Then what is the use of deployment ?
- Kubernetes offers you something like AUTOHEALING & AUTOSCALING it is done by kubernetes deployment
- Deployment will End of the day do deployment only, Instead of deploying a pod if we deploy a deployment resource, It will again create intermediate source called replica set then replica set will create something called pod
- Kubernetes suggests us to do not create pod directly, But create is using a deployment resource -- firstly i will create a replica-set which is kubernetes controller and it will rollout our pods
- Inside the deployment.yaml manifest relica-set count as 2 or 3 based on the requirement but when we given this manifest file their had something in kuberenets that ensure that if have 2 pods, even if user delete on the pods accidently, be'coz in manifest it is 2 it will implement autohealing and make 2 no of pods.
- The end process it you will create a deployement and it will rollout replica-set and this is create no of pods that we have mentioned in deployment.yaml file, Replica-set ensure to implement the auto-healing capability, It is called Zero downtime deployment. Replica-set is called kubernetes controller
- Controllers - They maintain a state, it always ensures that the desired state is present on the acutal cluster both are some or not. We can create custom controllers as well.
To get all the deployments, pods, psv, svc and etc use (All the resouces in particular name space)
kubectl get all
To get all resources with all the namespaces
kubect get all -A
ssh -i <>
ssh -i (identity) name or node or ip address of the node
- Difference between pods vs container vs deployment
- depolyment and replica-set
kubectl apply -f deployment.yml
OR
kubectl create -f deployment.yml
NOTE: AS SOON AS WE CREATED DEPLOYMENT WE HAVE DEPLOYMENT AND POD AS WELL BE'COZ OF REPLICAS it is done by replica-set controller
To get the deployment
kubectl get deploy
To get pods
kubectl get pods
kubectl get rs
kubectl get pos -w
To delte all the resources like pods, deployments, svc and etc
kubectl delete all -all -n <name-sapce>
minikube service node-app-service
idrbt1@idrbt1:~/k8s$ minikube service node-app-service
|-----------|------------------|-------------|-----------------------------|
| NAMESPACE | NAME | TARGET PORT | URL |
|-----------|------------------|-------------|-----------------------------|
| default | node-app-service | 5000 | http://192.168.59.100:30001 |
|-----------|------------------|-------------|-----------------------------|
🎉 Opening service default/node-app-service in default browser...
NOTE: DEPLOYMENT is an abstraction, that means we don't have to create replica-sets, pods, It says create one resouce called deployment.yaml and i will create the rest of them, It is responsible for auto-healing and zero down time in kubernetes, deployment will take help of replica-set and replica-set is kubernetes controller which is actually doing it
- It is nothing but a Go language application that kubernetes as written which will ensure that a specific behaviour is implemented, Ex:
4) It is again re-creating be'coz of auto-healing , Replica-set controller will do this
https://www.baeldung.com/linux/kubernetes-delete-all-pods
- We never create pods directly
- We create deployment and it will created Replica-set and then Pod will be created