08/11/2020 - KUBERNETES
List below contains mostly used Kubernetes commands. You can see wide range of commands here and here.
$ kubectl api-resources --verbs=list -o name
$ kubectl delete pods --all
$ kubectl describe node
$ kubectl config get-contexts
$ kubectl get all --all-namespaces
$ kubectl get all pods
$ kubectl get pods some-pod-name -o json
$ kubectl describe pod some-pod-name
$ kubectl exec -it some-pod-name -c some-container-name sh
$ kubectl port-forward some-pod-name some-local-port:some-k8s-port
$ kubectl logs some-pod-name
$ kubectl logs -f some-pod-name some-container-name
$ kubectl logs -f some-pod-name some-container-name | grep -ev '(health|metrics)'
$ kubectl logs -f --tail 5 deployment.apps/pacman
$ watch 'kubectl get pods'
$ kubectl rollout restart deployment/some-deployment-name
$ kubectl rollout restart deploy some-deployment-name
$ kubectl delete pod some-pod-name
If you delete a namespace, all the resources within will be deleted.
$ kubectl delete namespace some-namespace
$ kubectl config set-context --current --namespace=some-namespace
$ kubectl get events
$ kubectl set env deployment/some-deployment-name some-env-var=some-value
$ kubectl set image deployment/some-deployment-name some-container-name=some-image-name:version