source <(kubectl completion bash) kubectl config view kubectl config view -o jsonpath='{.users[?(@.name == "k8s")].user.password}' foo.kuberntes.comkubectl config set-credentials kubeuser/foo.kubernetes.com --username=kubeuser --password=kubepassword kubectl config set-context --current --namespace=namespace_name kubectl get services kubectl get pods -o wide --all-namespaces kubectl get pods -o json kubectl describe nodes my-node kubectl get services --sort-by=.metadata.name kubectl get pods --sort-by='.status.containerStatuses[0].restartCount' kubectl rolling-update frontend-v1 -f frontend-v2.json kubectl scale --replicas=3 rs/foo kubectl scale --replicas=3 -f foo.yaml for i in 0 1; do kubectl exec foo-$i -- sh -c 'echo $(hostname) > /usr/share/nginx/html/index.html'; done kubectl explain pods,svc kubectl create -f ./my-manifest.yaml kubectl apply -f ./my-manifest.yaml kubectl run nginx --image=nginx cat <<EOF | kubectl create -f - apiVersion: v1 kind: Secret metadata: name: mysecret type: Opaque data: password: $(echo "s33msi4" | base64) username: $(echo "jane"| base64) EOF kubectl delete -f ./my-manifest.yaml kubectl create -f deploy/kube-config/standalone/ kubectl top node kubectl top pod kubectl top pod pod_name --containers kubectl logs pod_name kubectl logs -f pod_name -c my-container kubectl exec pod_name -- command_name kubectl exec pod_name -c container_name -- command_name kubectl exec -it pod_name /bin/sh kubectl exec -it pod_name -c container_name /bin/sh https://raw.githubusercontent.com/LeCoupa/awesome-cheatsheets/refs/heads/master/tools/kubernetes.md