How do you base64-encode values for a Secret, and when should you use `stringData`?
BeginnerConceptTemplating: Go Templates & Sprig
Answer
apiVersion: v1
kind: Secret
type: Opaque
data:
password: {{ .Values.db.password | b64enc | quote }}
# or
stringData:
password: {{ .Values.db.password | quote }}
stringData is simpler and avoids double encoding mistakes; the API server converts it to data. Either way, the plain value is stored in the Helm release Secret (merged values), so anyone who can read Secrets in the namespace can read it. Base64 is encoding, not encryption.
More on Templating: Go Templates & Sprig
What template language does Helm use?BeginnerWhat does the dot (`.`) mean in a Helm template?BeginnerWhat is `$` and when do you need it?IntermediateHow does whitespace control (`{{-` and `-}}`) work?BeginnerHow do `if`, `else if` and `else` evaluate truthiness?BeginnerWhat do `and`, `or`, `not`, `eq`, `ne`, `lt`, `gt` look like in Helm?Beginner