Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 693
Xela Avatar asked Sep 01 '25 20:09

Xela


1 Answers

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.
  • also check if there is an operator running whose job is to manage specific kubernetes resources (read more on operator pattern)

Thanks to @P....for comments.

like image 152
4 revs, 2 users 95%mozello Avatar answered Sep 03 '25 14:09

4 revs, 2 users 95%mozello