Issue 1:
Is this a request for help? (If yes, you should use our troubleshooting guide and community support channels, see http://kubernetes.io/docs/troubleshooting/.): No

What keywords did you search in Kubernetes issues before filing this one? (If you have found any duplicates, you should instead reply there.):

Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG REPORT

Kubernetes version (use kubectl version):

1.4.6

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:~#

Environment:

Cloud provider or hardware configuration: hardware configuration

OS (e.g. from /etc/os-release): Ubuntu 14.04.3

Kernel (e.g. uname -a): Linux c910f04x19k02 3.19.0-74-generic #82~14.04.1-Ubuntu SMP Fri Oct 21 15:43:47 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Install tools:

Others:

What happened:

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".

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).

We have figured out a way to delete these conflicting deployments through kubectl editing deployment <deployment_name> 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.

What you expected to happen:

The users should be able to delete the deployments with conflicting labels.

How to reproduce it (as minimally and precisely as possible):

Create the deployment definition yaml files with conflicting labels:

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#

Create the deployment

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#

Try to delete the deployments, will get error

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#

Anything else do we need to know:

Issue 2:
When I tested with deployment, found some issue. The steps to reproduce is

Create a deployment with the example online http://kubernetes.io/docs/user-guide/deployments/#what-is-a-deployment

Edit the deployment yaml file, just change the name of the deployment, and create a second one.

After creating, check the deployment status. The first one is running correctly. The second one returned the error

SelectorOverlap found deployment default/nginx-deployment2 has overlapping selector with an older deployment default/nginx-deployment, skip syncing it

Deployment status

NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE

nginx-deployment 3 3 3 3 3m

nginx-deployment2 3 0 0 0 2m

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)

Delete the deployments, both returns with error

error: error when stopping "deployment.yaml": timed out waiting for the condition

Check the status

NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE

nginx-deployment 0 3 3 3 48m

nginx-deployment2 0 0 0 0 47m

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).