Introduction Why & What ? Benefits of Kubernetes Compare with other container orchestrator engine minikube intoduction & setup
make sure minikube is running -> if not run "minikube start" then run "kubectl apply -f pod.yml" to check status "kubectl get po welcom-pod" to get detailed info "kubectl describe po welcome-pod" to delete the pod "kubectl delete po welcome-pod"
kubectl apply -f initcontainer-nodeapp.yml
kubectl get po foss-app-with-init
kubectl describe po foss-app-with-init
kubectl delete -f initcontainer-nodeapp.yml
kubectl apply -f replication.yml kubectl describe replicationcontrollers/nginx kubectl describe rc nginx kubectl delete replicationcontrollers/nginx
List on which node pods are running inside cluster (Since I am using minikube, we'll find no change in node) kubectl get po -o wide
To list all available nodes. (Since working on minikube only one node i.e minikube will be visible) kubectl get nodes
- useful when traffic increases on application.
kubectl describe rc nginx Observe the replicas
kubectl scale rc nginx --replicas=5 kubectl describe rc nginx Observe the changes.
kubectl get rc nginx This will show desired and current state with ready as well.
kubectl apply -f replicaSet-MatchExpression.yml kubectl get pods kubectl get rs nginx-rs -o wide kubectl describe rs nginx-rs
kubectl scale rc nginx-rs --replicas=6 kubectl get pods -o wide kubectl get po -l app=nginx-app
-
ReplicaController supports only Euaility based Selectors Operators -> ( = , == , !=) kubectl get pods -l app=nginx
-
ReplicaSet Supports Equality based and Set based selectors. Operators -> ( in , notin , exists)
kubectl create -f deployement.yml kubectl apply -f deployement.yml kubectl describe deploy nginx-deploy kubectl get po -l app=nginx-app
- Update version of nginx
kubectl set image deploy nginx-deploy nginx-container=nginx:1.9.1
kubectl edit deploy nginx-deploy
What if by mistake we did this nginx-container=nginx:1.91 insted of nginx-container=nginx:1.9.1 -- It will get stucked -- We need to do rollback to previous stable release kubectl set image deploy nginx-deploy nginx-container=nginx:1.91 kubectl set image deploy nginx-deploy nginx-container=nginx:1.91 --record -- with --record K8s will record this command in resource annotation kubernetes.io/change-cause
knoldus@nitin-knoldus:~/Desktop/KubernetesResources/Kubernetes-learning/Day4-Replicas/DocExamples$ kubectl rollout status deployment/nginx-deploy Waiting for deployment "nginx-deploy" rollout to finish: 1 out of 3 new replicas have been updated...
kubectl rollout history deployment/nginx-deploy kubectl rollout undo deployment/nginx-deploy kubectl rollout status deployment/nginx-deploy
- Scale up and Scale down kubectl scale deployment nginx-deploy --replicas=5 kubectl get deploy kubectl get po
kubectl scale deployment nginx-deploy --replicas=1 kubectl get deploy kubectl get po -l app=nginx-app
<<<<<<< HEAD
- kubectl label nodes minikube newlabel=minilabel
- watch kubectl get pods -n my-name
- kubectl create -f pod.yml -n my-name
- kubectl apply -f pod.yml -n my-name
- kubectl get pods -n my-name
- kubectl describe pods mypod -n my-name
- kubectl get pods -n my-name -o wide
- kubectl delete pods mypod -n my-name
=======
abf7692e61e6e4a55af1cb8576f88562c06672b4