k9s icon indicating copy to clipboard operation
k9s copied to clipboard

Cannot delete namespace

Open DamsPer opened this issue 2 years ago • 5 comments




Describe the bug It is not possible to delete a namespace with K9S. We have this error: Delete failed with ``delete access denied for user on ":v1/namespaces". With kubectl no error and the namespace is deleted.

Versions (please complete the following information):

  • OS: OSX or Ubuntu
  • K9s: v0.27.3
  • K8s: v1.23.14

Additional context We use Rancher to manage rights on clusters

DamsPer avatar Feb 15 '23 10:02 DamsPer

Hello @DamsPer! Can you please enable debug logs and put them here? Also, can you please show the kubectl command? Thanks!

slimus avatar Feb 15 '23 17:02 slimus

Hi,

Debug logs : 11:43PM DBG TABLE-UPDATER canceled -- "v1/namespaces" 11:43PM ERR Delete failed with ``delete access denied for user on "":v1/namespaces error="``delete access denied for user on \"\":v1/namespaces" 11:43PM DBG TABLE-UPDATER canceled -- "v1/namespaces"

kubectl command : kubectl delete ns idpe3310 namespace "idpe3310" deleted

DamsPer avatar Feb 15 '23 22:02 DamsPer

Are you sure k9s and kubectl use the same config?

slimus avatar Feb 16 '23 15:02 slimus

Yes, I'am sure.

On a log, I see a message about Port-Forward.

Could there be a link with my issue ?

DamsPer avatar Feb 16 '23 15:02 DamsPer

i got stumbled upon this as i was facing simillar issue. We use RBAC in order to isolate namespace access, and when using k9s as mentioned above in original issue description it fails where as kubectl it works (as it should, given that kubectl is targetting specific namespace).

It looks to me like k9s is doing selfsubjectaccessreview and rejecting it which is why i dont see forbid logs either i.e this is happening lot early. If the SAR check fails, the deletion is aborted, and the actual deletion request is never sent to the Kubernetes API server.

elsnepal avatar May 16 '25 21:05 elsnepal

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Oct 17 '25 02:10 github-actions[bot]