NonoPa Naka
NonoPa Naka

Reputation: 95

golang kubernetes api service account with rest.inclusterconfig

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

Answers (1)

Jonas
Jonas

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

Related Questions