Reputation: 95
Is it possible to specify or change the service account to be used when accessing the kube api from within the cluster using rest.InClusterConfig in golang? It seems to use the default service account (or the service account the pod running is under) but i want to use another service account. I am aware that i can use BuildConfigFromFlags and use the configs from a config file that may be tied to a service account, but i wanted to see if it is possible to override the service account with rest.InClusterConfig
Upvotes: 1
Views: 243
Reputation: 129025
In Kubernetes, a Pod (or multiple for the same service) has a ServiceAccount. That is the way it is designed.
This ServiceAccount can be a specific that you create, you don't have to use a default ServiceAccount in a Namespace.
Upvotes: 1