Create a new ServiceAccount named backend-sa in the existing namespace default, which has the capability to list the pods inside the namespace default.Create a new Pod named backend-pod in the namespace default, mount the newly created sa backend-sa to the pod, and Verify that the pod is able to list pods.Ensure that the Pod is running.
A) Explanation:
A service account provides an identity for processes that run in a Pod.
When you (a human) access the cluster (for example, usingkubectl), you are authenticated by the apiserver as a particular User Account (currently this is usuallyadmin, unless your cluster administrator has customized your cluster). Processes in containers inside pods can also contact the apiserver. When they do, they are authenticated as a particular Service Account (for example,default).
When you create a pod, if you do not specify a service account, it is automatically assigned thedefaultservice account in the same namespace. If you get the raw json or yaml for a pod you have created (for example,kubectl get pods/ -o yaml), you can see thespec.serviceAccountNamefield has beenautomatically set.
You can access the API from inside a pod using automatically mounted service account credentials, as described inAccessing the Cluster. The API permissions of the service account depend on theauthorization plugin and policyin use.
In version 1.6+, you can opt out of automounting API credentials for a service account by settingautomountServiceAccountToken: falseon the service account:
apiVersion: v1
kind: ServiceAccount
metadata:
name: build-robot
automountServiceAccountToken: false
...
In version 1.6+, you can also opt out of automounting API credentials for a particular pod:
apiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
serviceAccountName: build-robot
automountServiceAccountToken: false
...
The pod spec takes precedence over the service account if both specify aautomountServiceAccountTokenvalue.
Alisha
6 months agoGeorgene
6 months agoWillow
7 months agoWilliam
7 months agoPatti
7 months agoMajor
7 months agoHeike
7 months agoRutha
8 months agoNatalya
8 months agoAlise
8 months agoVeda
8 months agoKatina
8 months agoTheola
9 months agoGlenna
1 year agoLeoma
1 year agoBilly
12 months agoSena
12 months agoVilma
1 year agoKyoko
1 year agoAlethea
1 year agoLeota
1 year agoKayleigh
1 year agoJina
1 year agoVal
1 year agoLeontine
1 year agoSamira
1 year agoKattie
1 year agoJoanna
1 year agoSharika
1 year agoEva
1 year agoVal
1 year agoNorah
1 year agoCamellia
1 year agoElenor
1 year agoCarlota
1 year agoNieves
1 year agoTruman
1 year agoSantos
1 year agoYuonne
1 year agoLeatha
1 year ago