Not able to delete empty `Namespaces`, Namespaces are stuck in terminating state forever after deleting
- Dominant language
- Shell
- Stars
- 5.4k
- Forks
- 334
- PR merge metrics
- No merged PRs in 30d
Description
# ***kubectl get ns metrics -o yaml***
```
apiVersion: v1
kind: Namespace
metadata:
creationTimestamp: "2020-07-18T09:31:50Z"
deletionTimestamp: "2020-07-31T23:19:14Z"
name: metrics
resourceVersion: "3080934"
selfLink: /api/v1/namespaces/metrics
uid: 8bcddadc-f2b2-4073-a765-c27c88626690
spec:
finalizers:
- kubernetes
status:
conditions:
- lastTransitionTime: "2020-07-31T23:19:19Z"
message: 'Discovery failed for some groups, 1 failing: unable to retrieve the
complete list of server APIs: metrics.k8s.io/v1beta1: the server is currently
unable to handle the request'
reason: DiscoveryFailed
status: "True"
type: NamespaceDeletionDiscoveryFailure
- lastTransitionTime: "2020-07-31T23:19:19Z"
message: All legacy kube types successfully parsed
reason: ParsedGroupVersions
status: "False"
type: NamespaceDeletionGroupVersionParsingFailure
- lastTransitionTime: "2020-07-31T23:19:19Z"
message: All content successfully deleted, may be waiting on finalization
reason: ContentDeleted
status: "False"
type: NamespaceDeletionContentFailure
- lastTransitionTime: "2020-07-31T23:19:19Z"
message: All content successfully removed
reason: ContentRemoved
status: "False"
type: NamespaceContentRemaining
- lastTransitionTime: "2020-07-31T23:19:19Z"
message: All content-preserving finalizers finished
reason: ContentHasNoFinalizers
status: "False"
type: NamespaceFinalizersRemaining
```
------------------------------------------
# ***kubectl describe ns metrics***
```
Name: metrics
Labels:
Annotations:
Status: Terminating
```
------------------------------------------
# **k get all -n metrics**
```
No resources found in metrics namespace.
```
# ****I notice same issue in other two namespaces as well, and looks like this issue is occurring only in EKS 1.17 and not in EKS 1.15.****
- Steps for reproducing the issue.
Create Namespace and Deployment in EKS 1.17
```
apiVersion: v1
kind: Namespace
metadata:
name: testing2
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
namespace: testing2
spec:
selector:
matchLabels:
app: nginx
replicas: 1
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
```
- Next Delete the Deployment testing2
```kubectl delete delpoy/nginx-deployment -n testing2```
- Once the Deployment is deleted, try deleting the Namespace
``` kubectl delete ns/testing```
- Run kubectl get ns, and you will notice testing2 namespace will be stuck forever.
```
Naveen Kumar Sat Aug 01 ~ 🍺 👉 kubectl get ns
NAME STATUS AGE
metrics Terminating 14d
testing Terminating 17m
testing2 Terminating 13m <----
```
Contributor guide
Assessment
This issue has not been assessed yet.