Kubernetes deployment configuration yaml - Escaping Special Characters

Viewed 81

I would like to set the Keycloak Admin Password in my Kubernetes deployment.yaml. To do so I have added this to my environment variables:

- name: KEYCLOAK_ADMIN_PASSWORD
  value: 'ExamplePassword123£'

By adding the £ character I can no longer log into Keycloak with the password. I've tried:

£
\£
\u00a3
Removing the quotes

ExamplePassword123 is fine so it definitely is the addition of this character.

How can I correctly escape the £ character?

2 Answers

You could try base64-encoding it into a secret and then refer to it using something like:

- name: KEYCLOAK_ADMIN_PASSWORD
  valueFrom:
    secretKeyRef:
      name: name-of-secret
      key: password

You can try to use Kustomize to generate your secrets. When you develop kustomize generator, you don't need to base64 encode the values. Follow this guide for more information

Related