Compare node allocatable and capacity

Shows the reserved overhead on each node; the gap is kube and system reservations

kubectl get nodes -o json | jq -r '.items[] | {node:.metadata.name, capCPU:.status.capacity.cpu, allocCPU:.status.allocatable.cpu, capMem:.status.capacity.memory, allocMem:.status.allocatable.memory}'

tool
kubectl73 commands
tags
kubectlperformancemonitoringk8s

More kubectl commands

  • kubectl create configmap <name> --from-env-file=app.env -n <ns> --dry-run=client -o yaml | kubectl apply -f -; kubectl patch deploy/<name> -n <ns> --type=json -p='[{"op":"add","path":"/spec/template/spec/containers/0/envFrom/-","value":{"configMapRef":{"name":"<name>"}}}]'

    Builds a ConfigMap from a KEY=VALUE file, then adds it to the container envFrom with a JSON patch

  • kubectl get pods -A -o wide

    Shows every pod with its node and IP address

  • kubectl describe pod <name> -n <ns>

    Shows events, conditions and volume mounts; the first stop when a pod is unhappy

  • kubectl logs -f <pod> -n <ns>

    Streams logs in real time; for a pod with several containers add -c <container>

  • kubectl logs <pod> --previous -n <ns>

    Logs from the container that crashed or restarted last time; the real error is usually here

all 73 kubectl commands