Config - Service Accounts Flashcards

1
Q

What kind of accounts exist in Kubernetes? Who are they used by?

A
  • User account (humans: admins, developers)
  • Service Account (machines: monitoring application that interacts with Kubernetes API)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are Service Accounts used for?

A
  • used for authenticating a machine/appliaction that wants to interact with the kube-api
  • like a dashboard, that pulls information from the api
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you create a Service Account?

A

‘kubectl create serviceaccount < account-name>’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is created with the creation of the service account and where must it be used? (Deprecated)

A
  • simultaneously with the serviceaccount a token is created
  • the token must be used by the external appliaction wanting to interact with the kube api
  • Token is stored as a secret object
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the sequence when a service account is created?

A
  • create service account
  • create token
  • create secret-object to include the token
  • link secret object to service account
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the token generated with a service account used as and when?

A
  • during REST-API calls
  • used as a Authentication Bearer Token
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is different, when the application itself is also hosted on the cluster?

A

Process can be done easier:
- by mounting the secret-object as a volume in the pod, hosting the third-party application

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

By default how many service accounts are created?

  • -
A
  • one ‘default’ service account per namespace
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

When are the ‘default’ service accounts used?

A
  • whenever a pod is created, the default secret object is mounted as a volumeMount to that pod
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the default service account allowed to do?

A
  • limited capabilities
  • only allowed to run basic Kubernetes api queries
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do you define a Service Account for a pod?

A

Pod yaml:

spec: 
 containers:
 
  serviceAccountName: dashboard-sa

Testsss

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How can you explicitly specify not to use the default service account?

A

in pod-yaml, under spec:

automountServiceAccountToken: false
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the purpose of the TokenRequestAPI?

A
  • to provide a way to provision Kubernetes Service Account tokens that are more secure and scalable
  • as the default token has no expiery date
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What has changed with version 1.22?

A
  • when a new pod is created it no longer receives the default token
  • instead a token with a defined lifetime is generated through the TokenRequestAPI by the service account admission controller
  • this token is then mounted as a projected volume to the pod
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What changed with version 1.24?

A
  • when a service account is created it no longer creates a token / secret object
  • you must run the command ‘kubectl create token < service-account-name>’ to generate a token for that service
  • it has a expiery date
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

With what command can you create a token for a certain service account?

A

‘kubectl create token dashboard-sa’

17
Q

What happens when you create a token for a existing service account?

A
  • the token gets automatically configured for the service account
  • when the service account is mounted, it uses the token for communication
18
Q
A