How do you assign a custom service account to a Kubernetes pod?
Experience Level: Junior
Tags: Kubernetes
Answer
In the Pod manifest spec, modify the serviceAccountName field.
spec.serviceAccountName: your-custom-service-account
You can also edit the serviceAccountName by editing the JSON using jq.
Run the following command:
Related Kubernetes job interview questions
How do you get all events that Kubernetes logged for a pod with name pod1?
Kubernetes JuniorWhat command can you use to get the address of the Kubernetes control plane and cluster services?
Kubernetes JuniorWhat is a Kubernetes service account?
Kubernetes JuniorHow do you list Kubernetes service accounts?
Kubernetes JuniorHow do you create a Kubernetes job job1 with image busybox that will be executed 3 times and maximum of 2 job instances will run in parallel? The command executed in a job should be sleep 10 && echo "Hello world"
Kubernetes Medior