请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

怎样获取deployment的版本号

# kubectl get deployments. my-nginx  -o yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "3"
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"extensions/v1beta1","kind":"Deployment","metadata":{"annotations":{},"name":"my-nginx","namespace":"default"},"spec":{"template":{"metadata":{"labels":{"app":"my-nginx"}},"spec":{"containers":[{"image":"nginx:1.13.12","name":"my-nginx","ports":[{"containerPort":80}]}]}}}}
# kubectl get deployments. my-nginx -o go-template='{{.metadata.annotations.deployment.kubernetes.io/revision}}'
error: error parsing template {{.metadata.annotations.deployment.kubernetes.io/revision}}, template: output:1: bad character U+002F '/'

正在回答 回答被采纳积分+3

1回答

刘果国 2020-04-15 09:43:47

给你个示例:

kubectl get deploy xxx -o go-template='{{index .metadata.annotations "deployment.kubernetes.io/revision"}}'

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信