Using Kubernetes Secrets

Kubernetes secret object lets you store and manage sensitive information like passwords or keys. This section explains how a secret can be used with ActiveMatrix Service Grid - Container Edition application. For more information on Kubernetes secrets, refer to the Kubernetes documentation.

    Procedure
  1. Create a secret using Kubernetes manifest file, here is the sample manifest file:

    apiVersion: v1
    data:
      username: dXNlcjEK
      password: cGFzczEK
    kind: Secret
    metadata:
      name: mysecret
      namespace: airport
    type: Opaque

    Here fields username and password have values base64 encoded.

  2. Create Secret by using the following command:

    kubectl apply -f <manifest_file>.yaml 
  3. Use this value in the ActiveMatrix Service Grid - Container Edition application deployment file as environment variable.

     - name: sr.airPortCodeDB.password
       valueFrom:
          secretKeyRef:
               name: mysecret
               key: password
     - name: sr.airPortCodeDB.username
       valueFrom:
          secretKeyRef:
               name: mysecret
               key: username

Here airPortCodeDB is the shared resource name.