text_2025-12-10_19-04-34.txt

printf "%-30s %-6s %-45s %-20s\n" "DEPLOYMENT" "TOTAL" "POD NAME" "WORKER" && \
oc get deploy -o custom-columns=NAME:.metadata.name,TOTAL:.status.replicas --no-headers | \
while read dep total; do \
  # If a deployment has 0 replicas (scaled down), skip or set to 0
  if [ -z "$total" ] || [ "$total" = "<none>" ]; then total=0; fi; \
  
  # Fetch pods starting with the deployment name
  oc get pods -o custom-columns=NAME:.metadata.name,NODE:.spec.nodeName --no-headers | \
  grep "^$dep-" | \
  awk -v d="$dep" -v t="$total" '{printf "%-30s %-6s %-45s %-20s\n", d, t, $1, $2}'; \
done
Back to List