Description of problem: Given a existing replication controller named "test-a" specifies selector as "a=b" and has created pods, try to create another controller named "test-b", which also contains selector "a=b" and other selector "c=d" as well, then "test-b" cannot create pods correctly Version-Release number of selected component (if applicable): openshift/oc v1.0.6-997-gff3b522 kubernetes v1.2.0-alpha.1-1107-g4c8e6f4 How reproducible: Always Steps to Reproduce: 1. oc login and create a project 2. Create rc "test-a" first 1> $ cat test-a.yaml apiVersion: v1 kind: ReplicationController metadata: name: test-a spec: replicas: 1 selector: a: b template: metadata: labels: a: b spec: containers: - image: yapei/hello-openshift name: test-a restartPolicy: Always 2 > $ oc create -f test-a.yaml 3. Then create rc "test-b" 1> $ cat test-b.yaml apiVersion: v1 kind: ReplicationController metadata: name: test-b spec: replicas: 1 selector: a: b c: d template: metadata: labels: a: b c: d spec: containers: - image: yapei/hello-openshift name: test-b restartPolicy: Always 2> oc create -f test-b.yaml 4. Check rc and pods 1> $ oc get rc 2> $ oc get pods 3> $ oc describe rc test-b Actual results: 4. 2> Only pod of "test-a" exist NAME READY STATUS RESTARTS AGE test-a-3lknc 1/1 Running 0 39m 3> Name: test-b Namespace: xxia-proj2 Image(s): yapei/hello-openshift Selector: a=b,c=d Labels: a=b,c=d Replicas: 0 current / 1 desired Pods Status: 0 Running / 0 Waiting / 0 Succeeded / 0 Failed No volumes. Events: FirstSeen LastSeen Count From SubobjectPath Reason Message ───────── ──────── ───── ──── ───────────── ────── ─────── 1m 1m 1 {replication-controller } SuccessfulCreate Created pod: test-b-4pg6g Expected results: pod of "test-b" should exist Additional info:
This is working as designed. If you have multiple replication controllers with overlapping label selectors, they will fight with each other. The solution is to not have overlapping selectors across multiple RCs.
(In reply to Andy Goldstein from comment #1) > This is working as designed. If you have multiple replication controllers > with overlapping label selectors, they will fight with each other. The > solution is to not have overlapping selectors across multiple RCs. Sometimes when creating many resources, it is easy to forget which selectors have been already used, thus cause this overlapping issue. Is it better to add some mechanism to detect whether the new resource being created has overlapping selector with existing resources? If it detects, then prevent the new creation and give some prompt.
There is an open issue upstream for this: https://github.com/kubernetes/kubernetes/issues/2210