Any kubernetes cluster has 3 main components
- Control Plane
- Proxy network
To start minikube cluster
minikube start
To get pods
kubectl get pods
To Deploy to a pod / create a deployment
kubectl create deployment kubernetes-bootcamp --image=<Image_name>
To Delete a deployment
kubectl delete deployment <Deployment-Id>
Get Pod Name
export POD_NAME=$(kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
Get Pod data
kubectl get pod -o wide
Get Pod Information
kubectl describe pods
kubectl describe pod <POD-ID>
Execute A commond inside container
kubectl exec -ti $POD_NAME -- /bin/bash
Expose a deployment as a service
kubectl expose deployment/kubernetes-bootcamp --type="NodePort" --port 8080
Add a label
kubectl label pods $POD_NAME version=v1
Add a service / Remove service
kubectl expose deployment/kubernetes-bootcamp --type="NodePort" --port 8080
kubectl delete service -l app=kubernetes-bootcamp
Scale an app
kubectl scale deployments/<Deployment_name> --replicas=8
kubectl scale deployments/kubernetes-bootcamp --replicas=4
The proxy basically is a local server which allows you to interact with the server via curl requests
It is the smallest unit of K8s
Deployment creates a pod
A node is a physical machine or a VM, think of it as a worker. Each node must have
- Kubelet Process / agent for communicating to controle plane
- Docker runtime env