Kubernetes: modify a secret using kubectl?

前端 未结 8 891
被撕碎了的回忆
被撕碎了的回忆 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:53

    The fastest way I found:

    # You need a version of micro that includes this commit https://github.com/zyedidia/micro/commit/9e8d76f2fa91463be660737d1de3bff61258c90d
    kubectl get secrets my-secret -o json | jq -r .data.config | base64 -d | micro | base64 -w 0 | xclip -selection clipboard && kubectl edit secrets my-secret
    
    0 讨论(0)
  • 2021-01-31 14:54

    I implemented a kubectl plugin just for this.

    To install using krew

    kubectl krew update
    kubectl krew install modify-secret
    

    To run it

    kubectl modify-secret xyz -n kube-system
    

    Demo

    <img src="https://github.com/rajatjindal/kubectl-modify-secret/raw/master/demo/usage.gif" alt="using kubectl-modify-secret plugin" style="max-width:100%;">

    0 讨论(0)
提交回复
热议问题