Imperative Approach for Kubernetes control commands
1. Create a deployment [first-app=deployment name, mjuyelrana/kub-first-app=docker hub image name]
kubectl create deployment first-app --image=mjuyelrana/kub-first-app
2. To show all the deployments
3. To show all running pods
4. To delete a deployment [first-app=deployment name]
kubectl delete deployment first-app
5. To show the running services
6. To delete a service [first-app = service name]
kubectl delete service first-app
kubectl expose deployment first-app --type=LoadBalancer --port=8080
8. Create replicas of PODS [deployment/first-app=deployment pod]
kubectl scale deployment/first-app --replicas=3
9. Attaching new build to deployment [kub-first-app = Container name, mjuyelrana/kub-first-app= docker-hub image name]
kubectl set image deployment/first-app kub-first-app=mjuyelrana/kub-first-app
10. Rollout the new deployment
kubectl rollout status deployment/first-app
11. Show the histories of all deployments
kubctl rollout history deployment/first-app
kubctl rollout history deployment/first-app --revision=1
12. Undo an old deployment
kubectl rollout undo deployment/first-app --to-revision=1
Declarative Approach for kubernetes control
1. Create a deployment by deployment.yaml file
kubectl apply -f=deployment.yaml
2. Create a service by service.yaml file
kubectl apply -f service.yaml
3. Create multiple deployment
kubectl apply -f=deployment.yaml, service.yaml
4. Delete resources by yaml file/ Declarative fole [deployment.yaml=Yaml file for running deployment, service.yaml=Yaml file for attaching deployment]
kubectl delete -f=deployment.yaml,service.yaml
5. Delete deployment by labels
kubectl delete deployments,services -l group=second-app-label
6. Show default storage class
7. Show the persistent volume
8. Show the persistent volume claims
10. Show the cluster namespaces/domain name
1. To start or stop minikube
minikube start
minikube stop
2. To show minikube status
3. To show minikube dashboard in browser
4. Attach a deployment to minikube [first-app=deployment name]
minikube service first-app