Show exact API requests and steps
The flag --v=8 shows the requests with responses, including the request body.
For example, doing kubectl rollout undo deployment/version --v=8 | grep PATCH
is showing me the PATCH request body from kubectl.
View details about the cluster:
kubectl cluster-info
Get info:
kubectl get nodes
kubectl get deployment
kubectl get deployment -o yaml
kubectl get pods
kubectl get pods -o wide
kubectl get services
Watch All:
watch -n 1 kubectl get deployments,replicasets,pods,statefulsets,jobs,cronjobs,pv,pvc,svc,ingress
Get even more info:
kubectl describe pod nginx-depl-5c8bf76b5b-f8lsb
Explain / Documentation
kubectl explain pods
Create:
kubectl create deployment nginx-depl --image=nginx
Apply a pre-exising config:
kubectl apply -f nginx-depl.yaml
Edit:
Open a deployment's config in your text editor:
kubectl edit deployment nginx-depl
Edit ingresses:
kubectl edit -n test ingresses.networking.k8s.io
Logs:
kubectl logs nginx-depl-5c8bf76b5b-f8lsb
Start a terminal on a pod:
kubectl exec -it nginx-depl-5c8bf76b5b-f8lsb -- bin/bash
Delete:
kubectl delete deployment nginx-depl
Delete via config:
kubectl delete -f nginx-depl.conf
Dry Run:
kubectl run hello-kubernetes --image=nginx:alpine --dry-run=client
Port Forward:
kubectl port-forward hello-kubernetes 8080:80
Expose a Pod:
kubectl expose pod jsonserver1 --name=clusterip-jss --port=80 --target-port=3000
kubectl get endpoints clusterip-jss