您如何在已应用的部署中设置以下标签?
kubectl
正在设置:
kubectl label deployments my-deployment-v1 app=my-deployment
我需要以下服务才能找到它:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: my-deployment-v1
labels:
app: my-deployment
答案 0 :(得分:1)
您需要patch这样的资源:
kubectl patch deployments/my-deployment-v1 \
-p '{"spec":{"template":{"metadata":{"labels":{"app":"my-deployment"}}}}}'