Kubernetes: modify a secret using kubectl?

前端 未结 8 890
被撕碎了的回忆
被撕碎了的回忆 2021-01-31 14:17

How can I modify the values in a Kubernetes secret using kubectl?

I created the secret with kubernetes create secret generic, but t

8条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-31 14:31

    Deriving from 'Skeeves' answer:

    Base64 encode your value:
    echo -n 'encode_My_Password' | base64
    Open the secret in edit mode:
    kubectl edit secret my-secret

    The default editor will open, replace the value of an exiting key or add a new line and a new key with the encoded value. Save and close the file. The updated value or new key-value pair has now been added to the secret.

提交回复
热议问题