Membuat file yaml untuk service account bisa dengan perintah :

nano admin-sa.yaml

Isi file admin-sa.yaml sebagai berikut

apiVersion: v1
kind: ServiceAccount
metadata:
  name: k8sadmin
  namespace: kube-system

Membuat file yaml untuk RBAC bisa dengan perintah :

nano admin-rbac.yaml

Isi file admin-rbac.yaml sebagai berikut

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  namespace: kube-system
  name: k8sadmin
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
  - kind: ServiceAccount
    name: k8sadmin
    namespace: kube-system


Melakukan request token dengan perintah berikut

masadmin@PowerEdge-R740:~$ microk8s kubectl create token k8sadmin -n kube-system
eyJhbGciOiJSUzI1NiIsImtpZCI6IjNOQnR0ajdVdXJtVzBKSE5LVmxnYm1tSXVWejFNcGltZnJiRzhSeUJQd00ifQ.eyJhdWQiOlsiaHR0cHM6Ly
9rdWJlcm5ldGVzLmRlZmF1bHQuc3ZjIl0sImV4cCI6MTcwNzQxMjk5NiwiaWF0IjoxNzA3NDA5Mzk2LCJpc3MiOiJodHRwczovL2t1YmVybmV0ZXM                         
uZGVmYXVsdC5zdmMiLCJrdWJlcm5ldGVzLmlvIjp7Im5hbWVzcGFjZSI6Imt1YmUtc3lzdGVtIiwic2VydmljZWFjY291bnQiOnsibmFtZSI6Ims4                         
c2FkbWluIiwidWlkIjoiNDZkNTBkNDAtNTdjMy00MTkyLWE4NjItMGQ3OTg0NDQzODRiIn19LCJuYmYiOjE3MDc0MDkzOTYsInN1YiI6InN5c3Rlb                         
TpzZXJ2aWNlYWNjb3VudDprdWJlLXN5c3RlbTprOHNhZG1pbiJ9.NIbgEZfbWHOb8CliuPohfGuYKPxqwZRvOXr8UxuGW3BZjqICR046hlb_Lrpmf                         
LeOs72KC_TqOJcEDraAuVts5QHOQLuSzz8pGd2jpfVOQqoAUypMG4oqdnaRstt0xCTnper2GUZ8WZdtkR7eemMN8pwQWRgTTvpHwAzhdWIbZLq6ZE                         
M61M4H3xCpjoV7GSMJUK5drKEwRGel7LBZscc-CRp3xNuh4ceXXwE3WQPHpxaSOxJdc8cFzRjYIeevyft1iu1-MuvqzA2zNHqjfiojoqYZ3dY8SYv                        
2tscSy_vAkmVUdAsnz2uXnP8IhFNoo9-8Ty43XJHGTnJ6Ibtbv3qdZg

Leave a Reply

Your email address will not be published. Required fields are marked *