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

11,149

try this:

oc create secret generic privkey --from-file=/opt/privkey --dry-run -o yaml | oc replace -f -
Share:
11,149

Related videos on Youtube

zeh
Author by

zeh

Updated on June 04, 2022

Comments

  • zeh
    zeh about 2 years

    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.

  • zeh
    zeh about 6 years
    works like a charm. Thanks. I thought that a solution could be writing the yml file. the -o with replace works great
  • Bob Claerhout
    Bob Claerhout almost 5 years
    For newer openshift/OKD versions, when "oc replace -f -" is no longer working, use "oc apply -f -"