简体   繁体   中英

Kubernetes: Delete secret from pod

I have pod running my application. The pod also contains my secret. The secret mapped to /secret/mysecret.json . I connecting to my pod with ssh and try to remove the secret from this pod instance:

rm /secret/mysecret.json

I getting the Error:

rm: cannot remove 'mysecret.json': Read-only file system

According to this article , I tried to changed the readOnly settings to False . No success.

Also tried to unmount it, got errors:

$ umount /secret/mysecret.json
  umount: /app/secrets/app-specific: must be superuser to unmount

How I can delete secret from a pod?

You can not delete secret from pod as it is mapped as volume. Even if you managed to delete, it will be recreated. So if you want to remove secret from pod, change pod spec and delete that secret conf from spec itself.

你应该以 kubernetes 的方式处理这个问题:

kubectl delete secret <<secret name goes here>>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM