I'm trying to deploy a java application which requires a couple of environmetal variables to connect to other systems. I'm using kubernetes to deploy the application to a namespace. I manage to do this successfully. What I cannot seem to get correct is how to inject secret values from the pipeline environmental variables into secrets.yaml file. Obviously I don't want the secrets to be visible in the pipeline. Basically I'm trying to avoid doing this:
apiVersion: v1
kind: Secret
metadata:
name: access-keys
type: Opaque
data:
ACCESS_KEY: uio8093210980khdsk
and I want to do something like this(ACCESS_KEY is set as a variable in the pipeline):
apiVersion: v1
kind: Secret
metadata:
name: access-keys
type: Opaque
data:
ACCESS_KEY: $(ACCESS_KEY)
When running the pipeline with the value converted to base64 it works fine. As soon as I change the value in secrets.yaml to $(ACCESS_KEY) I get the below error:
[error]Error: 1 error occurred:
* Secret in version "v1" cannot be handled as a Secret: illegal base64 data at input byte 0
How should I approach this? or maybe there is a better way of hiding secrets in Azure Devops?