Creating internal users for a new Db2uInstance

When creating a new Db2uInstance in, you can specify a list of internal users to be created during the initial deployment.

About this task

Internal users are defined in the Db2uInstance custom resource (CR) specification. When the instance is deployed, the system automatically creates the specified users and generates secure passwords for each one.

Procedure

  1. Add the users to the internalUsers field in the authentication section of your Db2uInstance CR:
    authentication:
      internalUsers:
        enabled: true
        users:
        - username: user1
        - username: user2
  2. Deploy the Db2uInstance CR.
    The system creates the specified internal users and generates a password for each user.
  3. Retrieve the generated passwords from the Kubernetes Secrets.
    Passwords for all users are generated automatically and stored together in a shared Kubernetes Secret named credential (base64-encoded). This Secret contains entries for each user, including the instance user. For example:
    apiVersion: v1
    data:
      instancepassword: YnVnZ2xl
      user1pwd: UnZtc0F5Wk9vU3pmTUJs
      user2pwd: cGVhY2g=
    kind: Secret
    metadata:
      name: c-db2-oltp-next-gen-credentials
    
  4. To view the password for a user, decode the Secret:
    oc get secret <username> -n <namespace> -o jsonpath='{.data.password}' | base64 --decode