POD : It is a defination for how to run the container. Ex: In docker if we want to run a container "docker run port" In kubernetes we pass the value like port, volume, network etc in yaml file. pod.yaml file (Kubernetes manifest files)
Pod is also exactly like docker, but only difference is in docker we use commands like docker run p conatiner id v .. but here we use yaml files .. apiVersion, spec, kind and etc
Note: This can be achieved by docker containers also then why this yaml files and complex stuff what you have to run things using kubernetes -- Kubernetes is enterpise level platform it want to bring declarative capabilies or it want to build a standarization
NOTE: Kubernetes deals everything using yaml files.
Pod -- Is one or group of containers mmustly only one container but there are few cases like side-car conatiners, init conatienrs is are like supporting conatiners, it supports actual conatiner. Ex: A conatiners wants to read file from other conatiner like config files or user related data, Instaed of creating 2 different pods we can put both of them in singel pod what pod says is if you one or two conatiners or multiple conatiners inside a single pod kubernetes will ensure that both of the conatiners will have some advantages that's why you put one or group of containers inside a single pod when it is required.
- Kubernetes will allow you shared networking
- Shared storage
- Container a and container b inside a single pod can talk to each other using local host
- This is rare case like group of containers in single pod, The usually pratice is to create side-car containers or init containers
- Pods have cluster ip address, kube proxy will generate this ip addresses
- kubectl is command line for kubernetes
- directly interact with kubernetes clusters, kubetes get nodes, get pods and etc commands
Kubectl -- https://kubernetes.io/docs/tasks/tools/ minikube -- https://minikube.sigs.k8s.io/docs/start/#:~:text=Download%20and%20run%20the%20installer%20for%20the%20latest%20release.&text=Add%20the%20minikube.exe%20binary,to%20run%20PowerShell%20as%20Administrator.&text=If%20you%20used%20a%20terminal,reopen%20it%20before%20running%20minikube.
- Minikube is a CLI tool that helps to create kubernetes cluster
Kubernetes cluster will be started (Linux)
minikube start
Note: In windows or mac it will create a VM first on top of it will create a single node kubernetes cluster, In production we use master node and worker nodes based on requirements no. of workers nodes
Ref link : https://kubernetes.io/docs/concepts/workloads/pods/
- A pod is a specific to run a docker
Docker equlivant commmand kubernets
Create pod.yaml file
..
.....
.......
Create pod
kubectl create -f pod.yml
To get all pods
kubectl get pods
to get entire details of pod
kubectl get pods -o wide
To login to kubernetes cluster
minikube ssh
Note: In real we use master or worker node ip address and we will ssh it
To check pod is running or not
curl
NOTE: REF LINK FOR KUBERNETES CHEAT SHEET -- https://kubernetes.io/docs/reference/kubectl/cheatsheet/
To delete pods
kubectl delete pod nginx <pod-name>
- We have a wrapper called deployments in kubernetes
- We have to use deployments in kubernetes to get the features of autoscaling and autohealing
Note: In real we don't deploy pods we use deployments, stateful sets, deamon sets, Way to deploy apps
kubectl describe pod <pod-name>
kubectl describe pod nginx
To check lods
kubectl logs <pod-name>
kubectl logs nginx
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
To get logs of the pod
kubectl logs -f <pod-name>
To get exactly what is running when we run kubectl commmand
kubectl get pods -v=8
Note: As we increase the no of v value verbose we get more information







