Skip to content

Instantly share code, notes, and snippets.

@harryge00
Created May 22, 2018 11:30
Show Gist options
  • Save harryge00/2d61a03b565c6bfbe544ec7a868d4546 to your computer and use it in GitHub Desktop.
Save harryge00/2d61a03b565c6bfbe544ec7a868d4546 to your computer and use it in GitHub Desktop.
Calculate the total CPU limit of the first containers in a namespace of Kubernetes
kubectl get pods -n chenkunning-84 -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.spec.containers[0].resources.limits.cpu} {"\n"}{end}' |awk '{sum+=$2 ; print $0} END{print "sum=",sum}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment