'Kubernetes deployment and replicaset keep reappearing

First time Kubernetes user here.

I deployed a service using kubectl -n my_namespace apply -f new_service.yaml

It failed, with the pod showing Warning -Back-off restarting failed container

I am now trying to delete the failed objects and redeploy a fixed version. However, I have tried to delete the service, pod, deployment, and replicaset, but they all keep recreating themselves.

I looked at this thread but don't believe it applies since my deployment list:

apiVersion: apps/v1
kind: Deployment

Any input appreciated!



Solution 1:[1]

Posting this as Community wiki for better visibility. Feel free to expand it.


In a Kubernetes cluster:

  • if you delete Pods, but they are recreated again
    there is a Kubernetes Deployment / StatefulSet / DaemonSet / job that recreates them
    delete a Deployment / StatefulSet / DaemonSet to delete those pods, check k8s jobs
  • if you delete a ReplicaSet, but it is recreated again
    there is a Kubernetes Deployment that recreates it
    delete a Deployment to delete this replicaset
  • if you delete a Deployments / Services, etc., but they are recreated again
    there is a deployment tool like ArgoCD / FluxCD / other tool that recreates them
    configure ArgoCD / FluxCD / other deployment tool to delete them
  • also check if Helm is used, run helm list --all-namespaces to list installed releases.

Thanks to @P....for comments.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1