This article covers essential user management tasks in OpenShift, including creating users, mapping identities, managing service accounts, and configuring groups and role bindings.
In this lesson, we explore essential user management tasks in OpenShift. You will learn how to create users, map identities, manage service accounts, and configure groups and role bindings. This comprehensive guide is designed to help you seamlessly manage access and permissions within your OpenShift cluster.
Start by opening your terminal and creating a new user named “miketest” with the following command:
Copy
Ask AI
PS C:\Users\mike> oc create user miketestuser.user.openshift.io/miketest createdPS C:\Users\mike>
After creating the user, verify its creation by listing all users:
Copy
Ask AI
PS C:\Users\mike> oc get userNAME UID FULL NAME IDENTITIESdeveloper 577f362a-643f-456b-903d-1ccbfc0eb5f5 developer:devkubeadmin 3348c0e2-1e47-41c9-8548-ed8450ffbca2 developer:kubeadminmiketest e22c031c-5a37-4e10-90ec-5301379f451ePS C:\Users\mike>
Service accounts in OpenShift allow you to manage automated processes and application access. You can create them either through YAML definitions or directly via the command line.
To create a service account using a YAML definition in the limittester namespace, use the following configuration:
Copy
Ask AI
apiVersion: v1kind: ServiceAccountmetadata: name: example namespace: limittester
Alternatively, if you need a service account specific to the “limittester” namespace called “MikeSA” with permissions to manage Pods, you can easily create it using the OpenShift UI. Simply enter the desired parameters and click “Create.”
Managing groups and their role bindings is crucial for organizing user permissions. This section explains how to create a group and assign roles to it.
Next, using the OpenShift UI, navigate to the user management section and then to groups. Create a new group by applying a YAML similar to the example below. This group, called “testroles”, includes the user “tester”: