<p>Here is my deploment template:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    name: XXX
    version: {{ xxx-version }}
    deploy_time: "{{ xxx-time }}"
  name: XXX
spec:
  replicas: 1
  revisionHistoryLimit : 0
  strategy:
    type : "RollingUpdate"
    rollingUpdate:
      maxUnavailable : 0%
      maxSurge : 100%
  selector:
    matchLabels:
      name: XXX
      version: {{ xxx-version }}
      deploy_time: "{{ xxx-time }}"
  template:
    metadata:
      labels:
        name: XXX
        version: {{ xxx-version }}
        deploy_time: "{{ xxx-time }}"
    spec:
      containers:
      - image: docker-registry:{{ xxx-version }}
        name: XXX
        ports:
        - name: XXX
          containerPort: 9000
</code></pre>

karthikcru
<p>The key section in the documentation that's relevant to this issues is:</p>

<blockquote>
  <p>Existing Replica Set controlling Pods whose labels match <code>.spec.selector</code>but whose template does not match <code>.spec.template</code> are scaled down. Eventually, the new Replica Set will be scaled to <code>.spec.replicas</code> and all old Replica Sets will be scaled to 0.</p>
</blockquote>

<p><a href="http://kubernetes.io/docs/user-guide/deployments/" rel="noreferrer">http://kubernetes.io/docs/user-guide/deployments/</a></p>

<p>So the spec.selector should not vary across multiple deployments:</p>

<pre><code>selector:
    matchLabels:
      name: XXX
      version: {{ xxx-version }}
      deploy_time: "{{ xxx-time }}"
</code></pre>

<p>should become:</p>

<pre><code>selector:
    matchLabels:
      name: XXX
</code></pre>

<p>The rest of the labels can remain the same</p>
