Created
April 23, 2024 13:43
-
-
Save rsmitty/d57d334171e9ad47e2506688e508153e to your computer and use it in GitHub Desktop.
Create a service account for use outside of omni context
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Create service account | |
$ kubectl -n kube-system create serviceaccount <user-name> | |
## Bind the service account to the cluster-admin role | |
$ kubectl create clusterrolebinding <user-name> --clusterrole=cluster-admin --serviceaccount=kube-system:<user-name> | |
## Create a token for the service account | |
$ kubectl create token <user-name> -n kube-system | |
## Create a kubeconfig with this new token | |
apiVersion: v1 | |
clusters: | |
- cluster: | |
server: https://<control plane ip>:6443 | |
name: <cluster-name> | |
contexts: | |
- context: | |
cluster: <cluster-name> | |
namespace: default | |
user: <user-name> | |
name: <cluster-name> | |
current-context: <cluster-name> | |
kind: Config | |
preferences: {} | |
users: | |
- name: <user-name> | |
user: | |
token: <generated token> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment