How does Kubernetes manage service accounts?

The API server has a dedicated component named the service account admission controller. It is responsible for checking, at pod creation time, whether it has a custom service account and, if it does, that the custom service account exists. If there is no service account specified, then it assigns the default service account.

It also ensures that the pod has ImagePullSecrets, which are necessary when images need to be pulled from a remote image registry. If the pod spec doesn't have any secrets, it uses the service account's ImagePullSecrets.

Finally, it adds a volume with an API token for API access and a volumeSource mounted at /var/run/secrets/kubernetes.io/serviceaccount.

The API token is created and added to the secret by another component named the Token Controller whenever a service account is created. The Token Controller also monitors secrets and adds or removes tokens wherever secrets are added or removed to/from a service account.

The service account controller ensures that the default service account exists for every namespace.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset