It is a kubernetes command line tool. It controls the Kubernetes cluster manager. It allows to run commands against our cluster.
kubectl version- show the client and server version infokubectl api-resources- show all Kubernetes resourceskubectl run hello-nginx --image=nginx:latest --port=80- start a nginx pod, let the container expose port 80kubectl get pod hello-nginx -o wide- show one-liner info about the podkubectl describe pod hello-nginx- show info about the podkubectl describe deployment hello-nginx- show info about deployment 'hello-nginx'kubectl exec -it hello-nginx -- sh- SSH into the container (if 1 container in the pod)kubectl exec -it hello-nginx -c hello-kenny -- sh- SSH into the container 'hello-kenny' (if many containers in the pod)kubectl exec hello-nginx -- ls /var- execute command in the containerkubectl get events --sort-by=.metadata.creationTimestamp- show logs to find a reason of problem withContainerCreatingStatuskubectl get namespaces- show all namespaceskubectl get nodes- show nodes in the clusterkubectl get pods- show running podskubectl get pod -n kube-system- show pods in the namespacekubectl get pods -A- show all pods in all namespaceskubectl get all -A- show everything in all namespaseskubectl get deployments- show deploymentskubectl delete deployment hello-nginx- delete deployment 'hello-nginx'kubectl get replicaset,kubectl get rs- show replicasetskubectl logs hello-nginx- show logs of the default containerkubectl logs hello-nginx -c hello-kenny- show logs of the container 'hello-kenny' within the pod 'hello-nginx'kubectl port-forward pod/hello-nginx 8080:80- forward port 8080 from host to port 80 in the containerkubectl delete pod hello-nginx- delete podkubectl apply -f hello-nginx.yml- create pod from .yml filekubectl replace --force -f deployment.yml- apply changes from .yml file in forced modekubectl delete -f hello-nginx.yml- delete podkubectl rollout history deployment- show deployments historykubectl rollout history deployment hello-nginx --revision=2- show info about specific deployment revisionkubectl rollout undo deployment hello-nginx- rollback deploymenthello-nginxkubectl rollout status deployment hello-nginx- show info about rollout status
minikube config set driver docker- set docker as default driverminikube start- start a local Kubernetes clusterminikube start --alsologtostderr --v=2- start minikube and output all the important debug logs to stderrminikube start --vm-driver hyperv- start minikube using HyperV instead default VirtualBox driverminikube start --nodes=2- start cluster with 2 nodesminikube dashboard- access the Kubernetes dashboard running within the minikube clusterminikube node add- add node to an existing clusterminikube node delete m02- delete node with namem02from clusterminikube stop- stop a running local Kubernetes clusterminikube delete- delete a local Kubernetes clusterminikube delete --all- delete all local clusters and profilesminikube status- show the status of a local Kubernetes clusterminikube ssh- SSH into the nodeminikube ip- shows the IP of master nodeminikube ip --node=minikube-m02- show the IP of nodeminikube node list- lists nodesminikube logs --node minikube-m02 -f- show logs of the node,-f- followingminikube image build -t local/customer:1 .- build image with minikube