Giving a user the minimum RBAC to install Cloud Pak for Data components

If a user other than the cluster administrator will install Cloud Pak for Data, you must give a Red Hat® OpenShift® Container Platform user the minimum role-based access control to install the Cloud Pak for Data software in the instance projects.

Who needs to complete this task?

Cluster administrator A cluster administrator must complete this task.

When do you need to complete this task?

If you are willing to give the user the admin role on the projects associated with the instance, see Authorizing a user to act as an IBM Cloud Pak for Data instance administrator.

Complete this task only if you want to enable another user to install an instance of Cloud Pak for Data without giving the user the admin role on the projects associated with the instance.

Restriction: You cannot use the minimum RBAC to upgrade an instance of Cloud Pak for Data from the following versions of Cloud Pak for Data Version 4.7.1.

The minimum RBAC method is supported only for customers on Cloud Pak for Data Version 4.7.2 or later.

Before you begin

Best practice: You can run many of the commands in this task exactly as written if you set up environment variables for your installation. For instructions, see Setting up installation environment variables.

Ensure that you source the environment variables before you run the commands in this task.

About this task

Use the show-minimum-rbac command to generate the YAML files that you can use to give a user the minimum RBAC to install the components associated with an instance of Cloud Pak for Data.

Important: This task is recommended only for customers with extremely rigid security requirements. It is not recommended for most customers because it requires additional planning and maintenance.
You must re-run the show-minimum-rbac command and reapply the roles in the following situations:
  • Each time you plan to install a newer version of Cloud Pak for Data.
  • Any time you plan to install a new service on the instance.

Regenerating and reapplying the roles ensure that the user has sufficient permissions to manage the resources that are associated with the instance of Cloud Pak for Data.

Procedure

  1. Log the cpd-cli in to the Red Hat OpenShift Container Platform cluster:
    ${CPDM_OC_LOGIN}
    Remember: CPDM_OC_LOGIN is an alias for the cpd-cli manage login-to-ocp command.
  2. Set the ROLE_NAME environment variable to a unique identifier for the role.
    The name must meet the following requirements:
    • Start with an alphanumeric character
    • Contain only alphanumeric characters and dashes (-)
    • Be a maximum of 20 characters
    export ROLE_NAME=<role_name>
  3. Run the cpd-cli manage show-minimum-rbac command to generate the YAML files that you can use to create the roles with the minimum RBAC for the components:
    cpd-cli manage show-minimum-rbac \
    --components=${COMPONENTS} \
    --release=${VERSION} \
    --role_name=${ROLE_NAME}
    The command generates the following YAML files in the work directory:
    • ${ROLE_NAME}-cpd-instance-admin.${VERSION}.yaml
    • ${ROLE_NAME}-cpd-instance-crs.${VERSION}.yaml
  4. Change to the work directory.
  5. Create the roles from the YAML files:
    1. Create the ${ROLE_NAME}-cpd-instance-admin role in the operators project for the instance:
      oc create \
      -f ${ROLE_NAME}-cpd-instance-admin.${VERSION}.yaml \
      --namespace=${PROJECT_CPD_INST_OPERATORS}
    2. Create the ${ROLE_NAME}-cpd-instance-crs role in the operators project for the instance:
      oc create \
      -f ${ROLE_NAME}-cpd-instance-crs.${VERSION}.yaml \
      --namespace=${PROJECT_CPD_INST_OPERATORS}
    3. Create the ${ROLE_NAME}-cpd-instance-admin role in the operands project for the instance:
      oc create \
      -f ${ROLE_NAME}-cpd-instance-admin.${VERSION}.yaml \
      --namespace=${PROJECT_CPD_INST_OPERANDS}
    4. Create the ${ROLE_NAME}-cpd-instance-crs role in the operands project for the instance:
      oc create \
      -f ${ROLE_NAME}-cpd-instance-crs.${VERSION}.yaml \
      --namespace=${PROJECT_CPD_INST_OPERANDS}
    5. Create the ${ROLE_NAME}-cpd-instance-admin role in any tethered projects for the instance:
      oc create \
      -f ${ROLE_NAME}-cpd-instance-admin.${VERSION}.yaml \
      --namespace=${PROJECT_CPD_INSTANCE_TETHERED}
      Repeat this step for each tethered project that is associated with this instance of Cloud Pak for Data.
      Tip: If you set the PROJECT_CPD_INSTANCE_TETHERED_LIST environment variable, print the list of tethered projects to the terminal:
      echo $PROJECT_CPD_INSTANCE_TETHERED_LIST

      Use this information to set the PROJECT_CPD_INSTANCE_TETHERED environment variable before you re-run the command.

    6. Create the ${ROLE_NAME}-cpd-instance-crs role in any tethered projects for the instance:
      oc create \
      -f ${ROLE_NAME}-cpd-instance-crs.${VERSION}.yaml \
      --namespace=${PROJECT_CPD_INSTANCE_TETHERED}
      Repeat this step for each tethered project that is associated with this instance of Cloud Pak for Data.
      Tip: If you set the PROJECT_CPD_INSTANCE_TETHERED_LIST environment variable, print the list of tethered projects to the terminal:
      echo $PROJECT_CPD_INSTANCE_TETHERED_LIST

      Use this information to set the PROJECT_CPD_INSTANCE_TETHERED environment variable before you re-run the command.

  6. Set the INSTANCE_ADMIN environment variable to the username of the Red Hat OpenShift Container Platform user that you want to give administration privileges to.
    export INSTANCE_ADMIN=<user>
  7. Assign the user the roles in the projects for the instance:
    Tip: The following steps use the oc adm policy add-role-to-user <role-name> <user-name> command. Alternatively, you can use the oc adm policy add-role-to-group <role-name> <group-name> command to authorize a group of Red Hat OpenShift Container Platform users.
    1. Assign the user the ${ROLE_NAME}-cpd-instance-admin role in the operators project for the instance:
      oc adm policy add-role-to-user ${ROLE_NAME}-cpd-instance-admin ${INSTANCE_ADMIN} \
      --namespace=${PROJECT_CPD_INST_OPERATORS} \
      --role-namespace=${PROJECT_CPD_INST_OPERATORS}
    2. Assign the user the ${ROLE_NAME}-cpd-instance-crs role in the operators project for the instance:
      oc adm policy add-role-to-user ${ROLE_NAME}-cpd-instance-crs ${INSTANCE_ADMIN} \
      --namespace=${PROJECT_CPD_INST_OPERATORS} \
      --role-namespace=${PROJECT_CPD_INST_OPERATORS}
    3. Assign the user the ${ROLE_NAME}-cpd-instance-admin role in the operands project for the instance:
      oc adm policy add-role-to-user ${ROLE_NAME}-cpd-instance-admin ${INSTANCE_ADMIN} \
      --namespace=${PROJECT_CPD_INST_OPERANDS} \
      --role-namespace=${PROJECT_CPD_INST_OPERANDS}
    4. Assign the user the ${ROLE_NAME}-cpd-instance-crs role in the operands project for the instance:
      oc adm policy add-role-to-user ${ROLE_NAME}-cpd-instance-crs ${INSTANCE_ADMIN} \
      --namespace=${PROJECT_CPD_INST_OPERANDS} \
      --role-namespace=${PROJECT_CPD_INST_OPERANDS}
    5. Assign the user the ${ROLE_NAME}-cpd-instance-admin role in any tethered projects for the instance:
      oc adm policy add-role-to-user ${ROLE_NAME}-cpd-instance-admin ${INSTANCE_ADMIN} \
      --namespace=${PROJECT_CPD_INSTANCE_TETHERED} \
      --role-namespace=${PROJECT_CPD_INSTANCE_TETHERED}
      Repeat this step for each tethered project that is associated with this instance of Cloud Pak for Data.
      Tip: If you set the PROJECT_CPD_INSTANCE_TETHERED_LIST environment variable, print the list of tethered projects to the terminal:
      echo $PROJECT_CPD_INSTANCE_TETHERED_LIST

      Use this information to set the PROJECT_CPD_INSTANCE_TETHERED environment variable before you re-run the command.

    6. Assign the user the ${ROLE_NAME}-cpd-instance-crs role in any tethered projects for the instance:
      oc adm policy add-role-to-user ${ROLE_NAME}-cpd-instance-crs ${INSTANCE_ADMIN} \
      --namespace=${PROJECT_CPD_INSTANCE_TETHERED} \
      --role-namespace=${PROJECT_CPD_INSTANCE_TETHERED}
      Repeat this step for each tethered project that is associated with this instance of Cloud Pak for Data.
      Tip: If you set the PROJECT_CPD_INSTANCE_TETHERED_LIST environment variable, print the list of tethered projects to the terminal:
      echo $PROJECT_CPD_INSTANCE_TETHERED_LIST

      Use this information to set the PROJECT_CPD_INSTANCE_TETHERED environment variable before you re-run the command.

Results

After you give a user the minimum RBAC to install an instance of Cloud Pak for Data, the user can complete Installing an instance of IBM Cloud Pak for Data.