Skip to content

Instantly share code, notes, and snippets.

@rduque1
Last active September 23, 2022 13:53
Show Gist options
  • Save rduque1/990f7fcade1a19205f23f13b0ac7e049 to your computer and use it in GitHub Desktop.
Save rduque1/990f7fcade1a19205f23f13b0ac7e049 to your computer and use it in GitHub Desktop.
Kubernetes
# get number of running pods
kubectl get -A pods --field-selector=status.phase=Running --output json | jq -j '.items | length'
# get number of NOT running pods
kubectl get -A pods --field-selector=status.phase!=Running --output json | jq -j '.items | length'
# find out why a pod is in pending
describe pod -n <namespace> <pod-name>
# get a node max number of pods
get node vmmts02 -ojsonpath='{.status.capacity.pods}{"\n"}'
# scale a deployment
kubectl scale -n <namespace> --replicas=1 deployment <deployment-name>
# list images
k3s crictl images
# list containers
k3s crictl ps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment