We run a kubernetes cluster on AWS.
When I attemp to delete a Deployment - the replica set gets deleted as well - but the pod is remaining and gets not deleted.
When I redeploy I get a new Deployment, new replica set and a new pod (so there are now 2 available...)
apiVersion: v1
kind: Service
metadata:
  name: helloworld
  labels:
    app: helloworld
spec:
  ports:
    - 
      port: 80
      targetPort: 10000
  selector:
    service: helloworld
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: helloworld
spec:
  replicas: 1
  revisionHistoryLimit: 0
  selector:
    matchLabels:
      service: helloworld
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      labels:
        service: helloworld
    spec:
      containers:
      - 
        name: helloworld
        image: 'my.service.io/service/helloworld:latest'
        imagePullPolicy: Always
        ports:
        - containerPort: 10000
        command:
        - node
        args:
        - "app.js"
      imagePullSecrets:
      - name: my-screts
      restartPolicy: Always
      terminationGracePeriodSeconds: 30Why isn't the pod deleted when deployment and replica sets are deleted?
Could it be that the pod was not deployed within the Deployment object? Did you, by any chance, manually deployed this Pod? If that is the case, it will not be removed when deleting the Deployment. Could you try to manually delete the Pod and see if the issue persists?
I had same problem and could solve it by deleting them manually as follow:
1.Get deployments
 kubectl get deployments- Delete deployment
kubectl delete deployments [NameOfDeployment]- Get Replication Controllers
kubectl get rc- Delete Replication Controllers
 kubectl delete deployments [NameOfrc]After deleting the replication controller/replicaset, you can delete pods and services manually same as deployment or rc.
You may need to forcefully delete the pod. Run the command
kubectl delete pod NAME --force --grace-period=0
terminationGracePeriodSeconds: 30 means that pod will remain in the list for 30s after you deleted deployment. It will have status: Terminating.
Are you sure that you give enough time for a pod to terminate gracefully?
You can also scale the deployment down to 0 replicas (replicas: 0) and then delete it.
Depends whether you are deleted when using - cascade [= true]
kubectl delete -f deploy  --cascade false