Set up basic authentication credentials using environment variables
An administrator can use the username and password container environment variables for basic authentication credentials.
After your WebSphereLibertyApplication image is deployed on our Kubernetes cluster, we can use the username and password environment variables for basic authentication with your username and password of choice.
- Create a secret with your wanted username and password values in our Kubernetes cluster.
- Modify our WebSphereLibertyApplication custom resource (CR) to add a .spec.envFrom parameter definition that references your secret. For example, add the following .spec.envFrom.secretRef parameter to your CR and replace
basic-auth with your secret.
spec: envFrom: - secretRef: name: basic-auth
- Ensure that the application container can access the secret.
The .spec.envFrom configuration sets two environment variables for the application container, username and password, and uses the username and password values in your secret.