我有以下两个命令及其输出,例如:
1) kubectl top pods
NAME CPU(cores) MEMORY(bytes)
am-cbkc-plugin-55b9df956f-sh82g 3m 923Mi
amd-apigw-stack-6df456664f-sbdvc 3m 491Mi
2) kubectl get pods -o=custom-kubectl get pods -o=custom-columns='NAME:metadata.name,CPULIM:spec.containers[*].resources.limits.cpu,MEMLIM:spec.containers[*].resources.limits.memory'
NAME CPULIM MEMLIM
am-cbkc-plugin-55b9df956f-sh82g 1 2Gi
amd-apigw-stack-6df456664f-sbdvc 550m 4Gi
如何根据"NAME"组合列?列?
NAME CPU(cores) MEMORY(bytes) CPULIM MEMLIM
....
我自己找到的,可以使用:
join -j1 <(kubectl get pods -o=custom-columns='NAME:metadata.name,CPULIM:spec.containers[*].resources.limits.cpu,MEMLIM:spec.containers[*].resources.limits.memory') <(kubectl top pods) | column -t