Search code examples
openshift

cannot delete unknown replicaset


all:

I got the following error when trying to delete an unknow replicaset. I asked my team and nobody claimed the ownership of this rs so i decided to delete it. but got this error.

➜  ~ oc get rs
NAME                                          DESIRED   CURRENT   READY   AGE
argocd-applicationset-controller-5466d654d5   1         1         1       7d9h
argocd-redis-fc877b4d                         1         1         1       23d
argocd-repo-server-58964f65bd                 1         1         1       23d
argocd-server-58b688f5d8                      1         1         1       23d
gowebapi-796fdbf457                           3         0         0       11d
pgo-676cdd4459                                1         1         0       17h
postgresql-standalone-db-57d677f8ff           0         0         0       39m
postgresql-standalone-db-65f79d87             1         1         1       100m
➜  ~ oc delete rc pgo-676cdd4459
Error from server (NotFound): replicationcontrollers "pgo-676cdd4459" not found
➜  ~ oc get rs
NAME                                          DESIRED   CURRENT   READY   AGE
argocd-applicationset-controller-5466d654d5   1         1         1       7d9h
argocd-redis-fc877b4d                         1         1         1       23d
argocd-repo-server-58964f65bd                 1         1         1       23d
argocd-server-58b688f5d8                      1         1         1       23d
gowebapi-796fdbf457                           3         0         0       11d
pgo-676cdd4459                                1         1         0       17h
postgresql-standalone-db-57d677f8ff           0         0         0       39m
postgresql-standalone-db-65f79d87             1         1         1       100m
➜  ~

Besides, in the log file, it shows the following error:

W1012 19:04:38.174999 1 reflector.go:324] k8s.io/[email protected]/tools/cache/reflector.go:167: failed to list *v1.StatefulSet: statefulsets.apps is forbidden: User "system:serviceaccount:dbaas-dev--runtime-int:pgo" cannot list resource "statefulsets" in API group "apps" at the cluster scope
E1012 19:04:38.175049 1 reflector.go:138] k8s.io/[email protected]/tools/cache/reflector.go:167: Failed to watch *v1.StatefulSet: failed to list *v1.StatefulSet: statefulsets.apps is forbidden: User "system:serviceaccount:dbaas-dev--runtime-int:pgo" cannot list resource "statefulsets" in API group "apps" at the cluster scope

Solution

  • You are attempting to delete a replicationcontroller (rc) and you are listing replicasets (rs).

    So that's your immediate problem: just a one character typo in your delete command. If you did oc delete rs pgo-676cdd4459 it would, assuming you have the right permissions, delete the replicaset.

    That said:

    • Why are you deleting and working with replicasets? Typically if you delete a replicaset it is just going to get immediately recreated by the deployment or whatever is its parent is.
    • Most likely a pgo replicaset is your Postgres operator
    • If you want more information on it (for example, what image it's running which would be a good hint as to what it is), I'd recommend doing a describe on it.