Replica Set 1
apiVersion: apps/v1
kind: ReplicaSet
metadata:
labels:
app: nginx
name: rs-1
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
version: 1.7.1
spec:
containers:
- image: nginx:1.7.1
name: nginx-1
restartPolicy: Always
Replica Set 2
apiVersion: apps/v1
kind: ReplicaSet
metadata:
labels:
app: nginx
name: rs-2
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
version: 1.7.9
spec:
containers:
- image: nginx:1.7.9
name: nginx-1
restartPolicy: Always
When I create these two ReplicaSets, one ignores the pods created by the other.
C02T30K2GTFM:ask erkanerol$ kubectl get pods --show-labels
NAME READY STATUS RESTARTS AGE LABELS
rs-1-996cz 1/1 Running 0 5m13s app=nginx,version=1.7.1
rs-1-ktv9z 1/1 Running 0 5m13s app=nginx,version=1.7.1
rs-1-w7sbg 1/1 Running 0 5m13s app=nginx,version=1.7.1
rs-2-2z8rb 1/1 Running 0 4m26s app=nginx,version=1.7.9
rs-2-5c56s 1/1 Running 0 4m26s app=nginx,version=1.7.9
rs-2-hls9p 1/1 Running 0 4m26s app=nginx,version=1.7.9
As far as I understand from the documentation, if there are enough pods which match a replicaset's selector, it shouldn't create new pods. Why is this happenning? Is it using ownerReferences?