Kubernetes Service Accounts¶
Outcomes¶
In this lab you will learn how to: - Create a service account - Use a service account to access the Kubernetes API
Outline¶
- Create a service account
$ kubectl create serviceaccount myserviceaccount
- Create a pod that uses the service account
$ kubectl run mypod --image=nginx --serviceaccount=myserviceaccount
- Get the token for the service account
$ kubectl get secret $(kubectl get serviceaccount myserviceaccount -o jsonpath='{.secrets[0].name}') -o jsonpath='{.data.token}' | base64 -d