1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/learning-getting-started-admin-cli.adoc

74 lines
1.8 KiB
Plaintext

// Module included in the following assemblies:
//
// * rosa_learning/creating_cluster_workshop/learning-getting-started-admin.adoc
:_mod-docs-content-type: PROCEDURE
[id="learning-getting-started-admin-cli_{context}"]
= Creating an admin user using the CLI
[role="_abstract"]
You can use the {rosa-cli-first} to create an admin user for your clusters.
.Procedure
. Run the following command to create the admin user:
+
[source,terminal]
----
$ rosa create admin --cluster=<cluster-name>
----
+
*Example output*:
+
[source,terminal]
----
W: It is recommended to add an identity provider to login to this cluster. See 'rosa create idp --help' for more information.
I: Admin account has been added to cluster 'my-rosa-cluster'. It may take up to a minute for the account to become active.
I: To login, run the following command:
oc login https://api.my-rosa-cluster.abcd.p1.openshiftapps.com:6443 \
--username cluster-admin \
--password FWGYL-2mkJI-00000-00000
----
. Copy the log in command returned to you in the previous step and paste it into your terminal. This will log you in to the cluster using the CLI so you can start using the cluster.
+
[source,terminal]
----
$ oc login https://api.my-rosa-cluster.abcd.p1.openshiftapps.com:6443 \
> --username cluster-admin \
> --password FWGYL-2mkJI-00000-00000
----
+
*Example output*:
+
[source,terminal]
----
Login successful.
You have access to 79 projects, the list has been suppressed. You can list all projects with ' projects'
Using project "default".
----
. To check that you are logged in as the admin user, run one of the following commands:
+
* Option 1:
+
[source,terminal]
----
$ oc whoami
----
+
*For example*:
+
[source,terminal]
----
cluster-admin
----
+
* Option 2:
+
[source,terminal]
----
oc get all -n openshift-apiserver
----
+
Only an admin user can run this command without errors.