Patching kubernetes secrets via circleci

I want to patch my K8s secrets via circleci.
I am storing my base64 encrypted secret in CircleCI environment variable.

But I am not able to patch it in a existing kubernetes secret.
I am trying to patch it in following way:-

kubectl patch secret mysecret --type='json' -p '[{"data": { "login_url" : ${LOGIN_URL} }}]' 

Can someone help me with the correct syntax ?

Hey There @engineerakki, welcome to CircleCI Discuss!

In bash, single quotes interpret everything inside of them as a string literal, not allowing for parameter expansion.

You can work around this by wrapping your parameter in single quotes. See the below example.

kubectl patch secret mysecret --type='json' -p '[{"data": { "login_url" : '${LOGIN_URL}' }}]' 
1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.