<p dir="auto"><strong>Is this a request for help?</strong> (If yes, you should use our troubleshooting guide and community support channels, see <a href="http://kubernetes.io/docs/troubleshooting/" rel="nofollow">http://kubernetes.io/docs/troubleshooting/</a>.): No</p>
<p dir="auto"><strong>What keywords did you search in Kubernetes issues before filing this one?</strong> (If you have found any duplicates, you should instead reply there.):</p>
<hr>
<p dir="auto"><strong>Is this a BUG REPORT or FEATURE REQUEST?</strong> (choose one): BUG REPORT</p>

<p dir="auto"><strong>Kubernetes version</strong> (use <code class="notranslate">kubectl version</code>):</p>
<p dir="auto">1.4.6</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="root@c910f04x19k02:~# kubectl version
Client Version: version.Info{Major:&quot;1&quot;, Minor:&quot;4&quot;, GitVersion:&quot;v1.4.6&quot;, GitCommit:&quot;e569a27d02001e343cb68086bc06d47804f62af6&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2016-11-12T05:22:15Z&quot;, GoVersion:&quot;go1.6.3&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}
Server Version: version.Info{Major:&quot;1&quot;, Minor:&quot;4&quot;, GitVersion:&quot;v1.4.6&quot;, GitCommit:&quot;e569a27d02001e343cb68086bc06d47804f62af6&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2016-11-12T05:16:27Z&quot;, GoVersion:&quot;go1.6.3&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}
root@c910f04x19k02:~# "><pre class="notranslate"><code class="notranslate">root@c910f04x19k02:~# kubectl version
Client Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.6", GitCommit:"e569a27d02001e343cb68086bc06d47804f62af6", GitTreeState:"clean", BuildDate:"2016-11-12T05:22:15Z", GoVersion:"go1.6.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.6", GitCommit:"e569a27d02001e343cb68086bc06d47804f62af6", GitTreeState:"clean", BuildDate:"2016-11-12T05:16:27Z", GoVersion:"go1.6.3", Compiler:"gc", Platform:"linux/amd64"}
root@c910f04x19k02:~# 
</code></pre></div>
<p dir="auto"><strong>Environment</strong>:</p>
<ul dir="auto">
<li><strong>Cloud provider or hardware configuration</strong>: hardware configuration</li>
<li><strong>OS</strong> (e.g. from /etc/os-release): Ubuntu 14.04.3</li>
<li><strong>Kernel</strong> (e.g. <code class="notranslate">uname -a</code>): Linux c910f04x19k02 3.19.0-74-generic <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="35620896" data-permission-text="Title is private" data-url="https://github.com/kubernetes/kubernetes/issues/82" data-hovercard-type="pull_request" data-hovercard-url="/kubernetes/kubernetes/pull/82/hovercard" href="https://github.com/kubernetes/kubernetes/pull/82">#82</a>~14.04.1-Ubuntu SMP Fri Oct 21 15:43:47 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux</li>
<li><strong>Install tools</strong>:</li>
<li><strong>Others</strong>:</li>
</ul>
<p dir="auto"><strong>What happened</strong>:</p>
<p dir="auto">Someone in our Kubernetes cluster accidentally created the deployments with conflicting labels with the existing deployment.  As expected, the new deployments could not be scheduled, but the problem is that the new deployments and the existing deployment could not be deleted, with error "timed out waiting for the condition".</p>
<p dir="auto">A more severe result is that these conflicts eventually crashed the kube-controller-manager after several days(we are actually not 100% sure if the crash was caused by the lables conflicting, but the conflicting messages are the only error messages in the kube-controller-manager log files).</p>
<p dir="auto">We have figured out a way to delete these conflicting deployments through kubectl editing deployment &lt;deployment_name&gt; to fix the conflicts, and then these deployments could be deleted. But this involves a lot of administrator effort and the risk of crashing the system.</p>
<p dir="auto"><strong>What you expected to happen</strong>:</p>
<p dir="auto">The users should be able to delete the deployments with conflicting labels.</p>
<p dir="auto"><strong>How to reproduce it</strong> (as minimally and precisely as possible):</p>
<ol dir="auto">
<li>Create the deployment definition yaml files with conflicting labels:</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="root@c910f04x19k02:~/yaml/nginx# cat nginx-1.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: my-nginx-1
spec:
  replicas: 4
  template:
    metadata:
      labels:
        app: my-nginx
    spec:
      containers:
      - name: my-nginx
        image: nginx:1.8.1
        ports:
        - containerPort: 80
root@c910f04x19k02:~/yaml/nginx# cat nginx-2.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: my-nginx-2
spec:
  replicas: 4
  template:
    metadata:
      labels:
        app: my-nginx
    spec:
      containers:
      - name: my-nginx
        image: nginx:1.8.1
        ports:
        - containerPort: 80
root@c910f04x19k02:~/yaml/nginx# cat nginx-3.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: my-nginx-3
spec:
  replicas: 4
  template:
    metadata:
      labels:
        app: my-nginx
    spec:
      containers:
      - name: my-nginx
        image: nginx:1.8.1
        ports:
        - containerPort: 80
root@c910f04x19k02:~/yaml/nginx# "><pre class="notranslate"><code class="notranslate">root@c910f04x19k02:~/yaml/nginx# cat nginx-1.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: my-nginx-1
spec:
  replicas: 4
  template:
    metadata:
      labels:
        app: my-nginx
    spec:
      containers:
      - name: my-nginx
        image: nginx:1.8.1
        ports:
        - containerPort: 80
root@c910f04x19k02:~/yaml/nginx# cat nginx-2.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: my-nginx-2
spec:
  replicas: 4
  template:
    metadata:
      labels:
        app: my-nginx
    spec:
      containers:
      - name: my-nginx
        image: nginx:1.8.1
        ports:
        - containerPort: 80
root@c910f04x19k02:~/yaml/nginx# cat nginx-3.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: my-nginx-3
spec:
  replicas: 4
  template:
    metadata:
      labels:
        app: my-nginx
    spec:
      containers:
      - name: my-nginx
        image: nginx:1.8.1
        ports:
        - containerPort: 80
root@c910f04x19k02:~/yaml/nginx# 
</code></pre></div>
<ol start="2" dir="auto">
<li>Create the deployment</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="root@c910f04x19k02:~/yaml/nginx# kubectl create -f nginx-1.yaml
deployment &quot;my-nginx-1&quot; created
root@c910f04x19k02:~/yaml/nginx# kubectl create -f nginx-2.yaml
deployment &quot;my-nginx-2&quot; created
root@c910f04x19k02:~/yaml/nginx# kubectl create -f nginx-3.yaml
deployment &quot;my-nginx-3&quot; created
root@c910f04x19k02:~/yaml/nginx#"><pre class="notranslate"><code class="notranslate">root@c910f04x19k02:~/yaml/nginx# kubectl create -f nginx-1.yaml
deployment "my-nginx-1" created
root@c910f04x19k02:~/yaml/nginx# kubectl create -f nginx-2.yaml
deployment "my-nginx-2" created
root@c910f04x19k02:~/yaml/nginx# kubectl create -f nginx-3.yaml
deployment "my-nginx-3" created
root@c910f04x19k02:~/yaml/nginx#
</code></pre></div>
<ol start="3" dir="auto">
<li>Try to delete the deployments, will get error</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="root@c910f04x19k02:~/yaml/nginx# kubectl delete deployment my-nginx-1 my-nginx-2 my-nginx-3
timed out waiting for the condition
timed out waiting for the condition
timed out waiting for the condition
root@c910f04x19k02:~/yaml/nginx# kubectl delete deployment my-nginx-3
error: timed out waiting for the condition
root@c910f04x19k02:~/yaml/nginx# kubectl delete deployment my-nginx-2
error: timed out waiting for the condition
root@c910f04x19k02:~/yaml/nginx# kubectl delete deployment my-nginx-1
error: timed out waiting for the condition
root@c910f04x19k02:~/yaml/nginx# kubectl get deployment
NAME         DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
my-nginx-1   0         4         4            4           10m
my-nginx-2   0         0         0            0           10m
my-nginx-3   0         0         0            0           10m
root@c910f04x19k02:~/yaml/nginx# "><pre class="notranslate"><code class="notranslate">root@c910f04x19k02:~/yaml/nginx# kubectl delete deployment my-nginx-1 my-nginx-2 my-nginx-3
timed out waiting for the condition
timed out waiting for the condition
timed out waiting for the condition
root@c910f04x19k02:~/yaml/nginx# kubectl delete deployment my-nginx-3
error: timed out waiting for the condition
root@c910f04x19k02:~/yaml/nginx# kubectl delete deployment my-nginx-2
error: timed out waiting for the condition
root@c910f04x19k02:~/yaml/nginx# kubectl delete deployment my-nginx-1
error: timed out waiting for the condition
root@c910f04x19k02:~/yaml/nginx# kubectl get deployment
NAME         DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
my-nginx-1   0         4         4            4           10m
my-nginx-2   0         0         0            0           10m
my-nginx-3   0         0         0            0           10m
root@c910f04x19k02:~/yaml/nginx# 
</code></pre></div>
<p dir="auto"><strong>Anything else do we need to know</strong>:</p>
<p dir="auto">When I tested with deployment, found some issue. The steps to reproduce is</p>
<ol dir="auto">
<li>Create a deployment with the example online <a href="http://kubernetes.io/docs/user-guide/deployments/#what-is-a-deployment" rel="nofollow">http://kubernetes.io/docs/user-guide/deployments/#what-is-a-deployment</a></li>
<li>Edit the deployment yaml file, just change the name of the deployment, and create a second one.</li>
</ol>
<p dir="auto">After creating, check the deployment status. The first one is running correctly. The second one returned the error<br>
SelectorOverlap found deployment default/nginx-deployment2 has overlapping selector with an older deployment default/nginx-deployment, skip syncing it<br>
Deployment status<br>
NAME                DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE<br>
nginx-deployment    3         3         3            3           3m<br>
nginx-deployment2   3         0         0            0           2m</p>
<p dir="auto">Although I didn't specify a selector in the yaml file, looks like it assigned a selector using the label name (both deployments use the same label name)</p>
<ol dir="auto">
<li>Delete the deployments, both returns with error<br>
error: error when stopping "deployment.yaml": timed out waiting for the condition<br>
Check the status</li>
</ol>
<p dir="auto">NAME                DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE<br>
nginx-deployment    0         3         3            3           48m<br>
nginx-deployment2   0         0         0            0           47m</p>
<p dir="auto">Note the objects still exist. For the first deployment, the desired is changed to 0, but current is still 3?! (I also checked the pods, no pod is running for deployment).</p>