After deployment, the pods, replicaset, and deployment are created successfully. However, when I try to delete the Deployment using kubectl delete deploy nginx-deployment
, the pods and replicaset are not deleted.
My deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
selector:
matchLabels:
app: nginx
replicas: 2 #
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
I have also tried kubectl delete deploy nginx-deployment --cascade=background
, but the issue persists. How should I proceed to ensure that the ReplicaSet and Pods are properly deleted when the Deployment is deleted?
Used software:
- Kubernetes 1.27.2
- Installed on Ubuntu 20.04.4 LTS
- calico 3.26.0
- containerd 1.6.24
2
Answers
This issue was solved by updating the calico version. Seems that there is an incompatibility issue.
Im sure you are deleting something that does not exists on the current name space. Do this:
1-get the deployment and its namespace
2-pass the namespace to the delete