k8s-jsonpath格式化输出
https://kubernetes.io/zh-cn/docs/reference/kubectl/jsonpath/
# 官网示例
kubectl get pods -o json
kubectl get pods -o=jsonpath='{@}'
kubectl get pods -o=jsonpath='{.items[0]}'
kubectl get pods -o=jsonpath='{.items[0].metadata.name}'
kubectl get pods -o=jsonpath="{.items[*]['metadata.name', 'status.capacity']}"
kubectl get pods -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.startTime}{"\n"}{end}'
快速获取容器资源限制
kubectl get pods -A |awk '!/NAME/{print "kubectl get pods -n "$1,$2" -o=jsonpath='{.metadata.name},{.spec.containers[*].resources}'"}' | bash
评论区