Kubernetes and containers¶
Tested with kubectl against k3s, and docker buildx 0.29.
What is actually eating the node¶
kubectl get pods -A -o custom-columns=\
'NS:.metadata.namespace,NAME:.metadata.name,'\
'CPU_REQ:.spec.containers[*].resources.requests.cpu,'\
'MEM_REQ:.spec.containers[*].resources.requests.memory,NODE:.spec.nodeName' \
--field-selector spec.nodeName="$NODE",status.phase=Running --sort-by=.metadata.namespace
Requests, not usage — this is what the scheduler reserved, which is what makes
a node "full" while top looks idle. status.phase=Running leaves out
finished jobs, which reserve nothing.
Reproducible container digest in CI¶
# Never deploy a tag. Tags move; digests do not.
DIGEST=$(docker buildx imagetools inspect "$IMAGE:$TAG" --format '{{json .Manifest}}' | jq -r .digest)
kubectl set image deploy/app "app=$IMAGE@$DIGEST"
For a multi-architecture image this is the digest of the index, so each node still pulls its own architecture.