Core Concepts Flashcards

1
Q

What is the command to create a pod

A

kubectl run nginx –image nginx

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

How do you delete a pod

A

kubectl delete pod <pod></pod>

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

How do you create a pod definition file using dry-run

A

kubectl run nginx –image=nginx –dry-run=client -o yaml

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

What does a pod deployment look like

A

apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: nginx
name: nginx
spec:
containers:
- image: nginx
name: nginx
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}

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

How do you find out about a object type ex. ReplicaSet

A

kubectl explain replicaset

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

Does the label in the selector for replicasets have to match the label in the template?

A

Yes

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

How do you modify an object when you don’t really know where the yaml file is?

A

kubectl edit <object> rs <name></name></object>

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

How do you create a deployment yaml file with replicas set

A

kubectl create deployment –image=nginx nginx –replicas=4 –dry-run=client -o yaml > nginx-deployment.yaml

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

How do you get all of the resources that are in a cluster

A

kubectl get all

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

What are the 3 types of Services (load balancers)

A

NodePort, ClusterIP, Loadbalancer

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

Is the Service type of LoadBalancer available everywhere?

A

No. It is only allowed with Cloud Providers that can support it. It is mentioned in the training that all of the big 3 meet the requirements.

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

How do you set the namespace you want to work in?

A

kubectl config set-context $(kubectl config current-context) –namespace=<namespace></namespace>

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

How do you manually schedule a pod?

A

Easiest way is to just put a nodeName field in the Pod definition file. You can also create a binding definition file, you need convert that to a JSON formatted file and send a binding request to the nodes binding API.

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

How do you look for the components of the k8s environment?

A

kubectl get pods -n kube-system

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

How do you find a resource by its label?

A

kubectl get pod –selector app=App1

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

How do you add a taint to a node?

A

kubectl taint nodes <node> key=value:[NoSchedule|PreferNoSchedule|NoExecute]</node>

17
Q

How do you add a toleration to a pod?

A

apiVersion: v1
kind: Pod
metadata:
labels:
run: bee
name: bee
spec:
containers:
- image: nginx
name: bee
restartPolicy: Always
tolerations:
- key: spray
value: mortein
operator: “Equal”
effect: NoSchedule

18
Q

How do you remove a taint from a node

A

kubectl taint node controlplane node-role.kubernetes.io/control-plane:NoSchedule- –namespace=kube-system

19
Q

How do you show detail about pods

A

kubectl get pods -o wide

20
Q

How do you check the kubelet service running on Linux

A

sudo systemctl list-unit-file –type service –all | grep kubelet -a6

21
Q

How do you list all of the API resources

A

kubectl api-resources –sort-by=name –namespaced=false

22
Q

How do you see the components in the control plane

A

kubectl get pods -n kube-system