<p>Is there a way to programmatically update a kubernetes secret from a pod? that is, not using kubectl.
I have a secret mounted on a pod and also exposed via an environment variable. I would like to modify it from my service but it looks that it's read only by default.</p>

Jorge
<p>You can use the Kubernetes REST API with the pod's serviceaccount's token as credentials (found at <code>/var/run/secrets/kubernetes.io/serviceaccount/token</code> inside the pod), you just need to allow the service account to edit secrets in the namespace via a role.</p>
<p>See <a href="https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/secret-v1/" rel="nofollow noreferrer">Secret</a> for the API docs</p>
<p>The API server is internally reachable via <a href="https://kubernetes.default" rel="nofollow noreferrer">https://kubernetes.default</a></p>
