Apply an vault encrypted secret.yaml on a k3s cluster

Lance_Lyons
Thu, 23 May 2024 16:01:44 +0000
Get Help

I have a kubernetes secret that has been encrypted by ansible-vault such that secret.yml is encrypted so if checked in, it wont be in plain text.

I would like to do a command on the k3s node to apply the decrypted secret.yml but the ansible-vault tool only exists on the machine with the playbook scripts

kubectl apply -f (decrypted secret.yml)

for other instances of doing kubectl apply -f someyamlfile.yaml, I would first copy that file over to the node and do the kubectl apply -f on the node

how would i decrypt on the server with ansible-vault / runbooks but do the kubectl apply -f decryptedsecret.yaml

thanks in advance

3 posts - 2 participants