Changing the cluster administrator access credentials
You can update the cluster administrator username and password.
Required user type or access level: Cluster administrator
Changing the cluster administrator username
Run the following commands to change the cluster administrator username. For more information about installing cloudctl, see Installing cloudctl.
-
Run the
cloudctl logincommand from any node that has access to your cluster. -
Use cloudctl to change your username and to restart deployments. For example:
cloudctl pm update-secret kube-system platform-auth-idp-credentials -d admin_username=<username>For more information, see cloudctl pm commands (pm).
-
Install kubectl. For more information, see Installing the Kubernetes CLI (kubectl).
-
Update the
clusterrolebindingrole-based access control (RBAC) object with the new username.kubectl edit clusterrolebinding oidc-admin-bindingFollowing is a sample
clusterrolebindingRBAC object:Please edit the following object. Lines beginning with a '#' will be ignored, # and an empty file will abort the edit. If an error occurs while saving this file will be # reopened with the relevant failures. # apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: creationTimestamp: 2019-02-04T18:44:34Z name: oidc-admin-binding resourceVersion: "3162" selfLink: /apis/rbac.authorization.k8s.io/v1/clusterrolebindings/oidc-admin-binding uid: eab9c9c9-28ac-11e9-aca2-0050569a1e29 roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-admin subjects: - apiGroup: rbac.authorization.k8s.io kind: User name: https://mycluster.icp:8443/oidc/endpoint/OP#admin <=========== - apiGroup: rbac.authorization.k8s.io kind: User name: admin <=========== -
Replace the admin name in
https://mycluster.icp:8443/oidc/endpoint/OP#adminwith the new name: changeOP#admintoOP#<new admin user name>. -
Replace the admin name in
name: adminwith the new name: changename: admintoname: <new admin user name>. -
Save the file.
Note: If you need to use the installer for any task such as enabling services, reinstallation, or for loading archives, you must update the default_admin_user in the config.yaml file.
- Open the
/<installation_directory>/cluster/config.yamlfile. - Add
default_admin_user: <updated-user-name>. - Save and exit the file.
Changing the cluster administrator password
Run the following cloudctl command to change the cluster administrator password. For more information about installing cloudctl, see Installing cloudctl.
cloudctl pm update-secret kube-system platform-auth-idp-credentials -d admin_password=<password>
If you want to change the password rules, you can run the following command:
cloudctl pm password-rule-set <namespace> <rule_name> <rule_regex> <rule_desc>
Note: If you need to use the installer for any task such as enabling services, reinstallation, or for loading archives, you must update the default_admin_password in the config.yaml file.
- Open the
/<installation_directory>/cluster/config.yamlfile. - Update the
default_admin_password. - Save and exit the file.