Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update Secrets (Without Deleting and Creating) in Openshift?

I have a folder in my server that I want to update inside a cointaier in a pod. How do I do that without deleting the Secret?

I know that the following creates my secret: oc create secret generic privkey --from-file=/opt/privkey

I know that the following deletes the secret:

oc delete secret generic privkey

Is there a way to do that without deleting? I am fine if I have to delete the pod.

like image 707
zeh Avatar asked Jun 01 '18 06:06

zeh


People also ask

Can you update a Kubernetes secret?

Edit a Secret To edit the data in the Secret you created using a manifest, modify the data or stringData field in your manifest and apply the file to your cluster. You can edit an existing Secret object unless it is immutable. Kubernetes updates the existing Secret object.

Can a pod update a secret?

If you update the secret, the change will propagate to all the pods that reference it (See the “Mounted Secrets are updated automatically” section of the guide on using secrets). This does require that your app re-read them after update (io-notify).

How does OpenShift store secrets?

Secret data volumes are backed by temporary file-storage facilities (tmpfs) and never come to rest on a node. Secret data can be shared within a namespace.


1 Answers

try this:

oc create secret generic privkey --from-file=/opt/privkey --dry-run -o yaml | oc replace -f -
like image 91
Kun Li Avatar answered Oct 03 '22 03:10

Kun Li