7+ Flashcards

1
Q

A ‘PodSelector’ field in a network policy maps to what?

A

A label within a pod

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

‘app’ is defined where?

A

Within deployment manifest

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

____ volumes create storage on a node when the pod is assigned to the node. The storage disappears when the pod leaves the node.

A

EmptyDir

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

How does a PVC bind to a PV?

A

via the ‘storageClassName’

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

kubectl command to view the stdout of a container?

A

logs

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

kubectl command to perform a shell command on the container?

A

exec

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

pod securityContext spec fields

A
  1. runAsUser

2. fsGroup

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

resources fields

A
  1. request (memory, cpu)

2. limits (memory, cpu)

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

how to export pod descriptor and save to file?

A

kubectl get pod [podname] -n [namespace] -o yaml –export > nginx-pod.yml

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

add to delete commands

A

–grace-period=0 –force

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

some debugging options for a bad pod

A

kubectl get pods -n [namespace]

kubectl top pods -n [namespace]

kubectl logs [podname] -n [namespace]

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

how to remove extraneous info from yaml output?

A

add –export after -o yaml

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

what is caveat of ‘export’ flag?

A

It removes the ‘namespace’ from the pod manifest, so you will have to specify the namespace when you kubectl apply

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

how to change image of deployment?

A

kubectl set image deployment/[deployment] imageName=image

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

how to see rollout status?

A

kubectl rollout status deployment/[deploymentname]

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

how to undo a rollout?

A

kubectl rollout undo deployment/[deploymentName]

17
Q

how do you get a deployment to target specific pod/s

A

via the selector.matchLabels value in the deployment spec

18
Q

what is a nodeport?

A

It is the publicly accessible port exposed by the service. Part of service spec (when type is NodePort)

19
Q

what is a containerport?

A

The exposed port of a container. (part of container spec in pod)

20
Q

how to switch cluster context?

A

kubectl config set-context –current –namespace [namespace]

21
Q

how to write a pod manifest via kubectl?

A

kubectl run nginx –image=nginx –dry-run=client -o yaml > pod.yaml

22
Q

dry run flag?

A

–dry-run=client