通过jsonpath获取deployment 的属性

kubectl get pods -n kube-system -o=jsonpath='{range .items[*]}[{.metadata.name},{.status.containerStatuses[0].image}]{"\n"}{end}'

kubectl get deployments -n kube-system -o=jsonpath='{range .items[*]}[{.metadata.name},{.spec.template.spec.containers[0].image}]{"\n"}{end}'

 

kubectl  get deployments. -n compute  -o=jsonpath='{range.items[*]}{.metadata.name}{"\n"}{end}'

#输出格式为:

xxx-front
xxx-service

 

 

 kubectl -n XXX get  lcr    -o=jsonpath='{range.items[*]}{.spec.data.release}{":"}{.spec.data.source.reference}{"\n"}{end}'

webshell:XXX
websocket-service:XXX

参考大佬博客:https://blog.51cto.com/u_11555417/5521927

posted on 2023-04-19 09:12  会飞的鱼会掉进海里吗  阅读(19)  评论(0编辑  收藏  举报