Kubernetes无法为pod添加标签

时间:2016-08-22 04:19:01

标签: kubernetes

我无法在我的kubernetes pod中添加标签。为什么这不起作用?

$ kubectl describe pods secure-monolith | grep Label
Labels:     app=monolith 

$ kubectl label pods secure-monolith "secure=enabled"
pod "secure-monolith" labeled

$ kubectl describe pods secure-monolith | grep Label
Labels:     app=monolith

$ kubectl label pods secure-monolith "secure=enabled"
'secure' already has a value (enabled), and --overwrite is false

正如您所看到的,它表示标签已成功添加,但标签在“描述”pod时不会出现;它也不能再添加。

2 个答案:

答案 0 :(得分:2)

您正在浏览describe输出,但只有第一行标签说明包含Label字符串。

两个标签的标签输出如下所示:

Labels:         a=b
                c=d

所以secure=enabled就在那里,你只是将其过滤掉了。

答案 1 :(得分:1)

kubectl获取广告连播 POD_NAME --show-labels

此命令显示添加到吊舱的所有标签