OpenShift - Delete kubeadmin user account

by
Jeremy Canfield |
Updated: January 21 2023
| OpenShift articles
If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.
Before you can delete the built in kubeadmin user account, you will need to assign the cluster-admin Cluster Role Binding to some other user account.
~]$ oc adm policy add-cluster-role-to-user cluster-admin john.doe
clusterrole.rbac.authorization.k8s.io/cluster-admin added: "john.doe"
In the kube-system namespace, there should be a secret named kubeadmin.
~]$ oc get secret kubeadmin --namespace kube-system --output yaml
apiVersion: v1
data:
kubeadmin: JDJhJDEwJDJiUExscmNDd1RDamk4QUs1ak5oOGUzblp1RU1XSndCZFkuQUZ0MmdXTEMxUGRndER3d1FD
kind: Secret
metadata:
creationTimestamp: "2021-07-16T17:09:50Z"
name: kubeadmin
namespace: kube-system
resourceVersion: "90"
uid: f86b63f7-dfe4-423f-9838-e70af0e0dafe
type: Opaque
Deleting the kubeadmin secret will effectively delete the built in kubeadmin user account.
oc delete secret kubeadmin --namespace kube-system
Did you find this article helpful?
If so, consider buying me a coffee over at