kubernetes: kubectl: cli can't create multiple labels with same key
Kubernetes version (use kubectl version
): v1.5.2
What happened:
I wanted to label a bunch of nodes with role=prow
and role=build
but I seem to only be able to do so with kubectl edit
.
What I tried:
-
kubectl label node --all role=build role=prow
resulted in only the latter label applying. -
kubectl label node --all role=build && kubectl label node --all role=prow
results in'role' already has a value (build), and --overwrite is false
… and--overwrite
does as it’s name implies. -
using a comma doesn’t work either, it fails the regex:
(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16 (1 by maintainers)
There was a question in my CKAD exam related to that… 2 NetworkPolicies already created were given. The question stated that I could not edit any of the two already created Network Policies. What should I do in order to have label app=db and app=redis in the same pod?
PS: One network policy had the podSelector with label app=db and the other had the podSelector with label app=redis.
I have got the same question on my CKAD and killed my time. Ideally the option is change network policy. but that was restricted, . Now I am curious why a question like that appeared. Is it a mistake? or any solution!!.
Same question here on CKAD. Anyone has any insight?
@ivneetsinghwahi03 - There was only one label available under podSelector in each network policy.