kubectl标签-如何标记“规格:模板:元数据:标签”

时间:2018-12-04 13:59:33

标签: kubernetes

您如何在已应用的部署中设置以下标签?

kubectl

正在设置:

kubectl label deployments my-deployment-v1 app=my-deployment

我需要以下服务才能找到它:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: my-deployment-v1
  labels:
    app: my-deployment

1 个答案:

答案 0 :(得分:1)

您需要patch这样的资源:

kubectl patch deployments/my-deployment-v1 \
-p '{"spec":{"template":{"metadata":{"labels":{"app":"my-deployment"}}}}}'