Create a Kubernetes Secret for Storing Database Username and Password
- Create a yaml file with the username and password with the syntax
shown
below:
apiVersion: v1 kind: Secret metadata: name: ocnssf-db-creds type: Opaque data: mysql-username: bnNzZnVzcg== mysql-password: bnNzZnBhc3N3ZA== mysql-db-name: bnNzZmRi
Note:
The values for mysql-username and mysql-password must be base64 encoded. - Execute the following command to create the kubernetes secret:
kubectl create -f yaml_file_name -n namespace
where:
yaml_file_name is a name of the yaml file that is created in step 1.
namespace is the deployment namespace used by the helm command.
- Execute the following command to verify the secret creation:
$ kubectl describe secret <database secret name> -n <Namespace of MYSQL secret>
Example:$ kubectl describe secret ocnssf-db-creds -n ocnssf