Kubernetes for the Absolute Beginners Flashcards

1
Q

What is the command to deploy a NGINX pod?

A

kubectl run nginx –image=nginx

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

What is the command to list pods?

A

kubectl get pods

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

What is the command to get more information about a pod?

A

kubectl describe pod <pod_name></pod_name>

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

What is the command to check the status of the pod with additional information?

A

kubectl get pods -o wide

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

What is the command to list nodes?

A

kubectl get nodes

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

What is the command to get verbose information about a node?

A

kubectl describe node

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

What are the 4 root or top level configurations in your pod-definition.yml?

A

apiVersion:
kind:
metadata:

spec:

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

What is the command to apply a pod.yaml file?

A

kubectl apply -f pod.yml

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

What is the command to delete a pod?

A

kubectl delete pod <pod_name></pod_name>

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

What is the command to dry run and output a pod to yaml?

A

kubectl run image –image=<image_name> --dry-run -o yml</image_name>

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

What does a replication controller do in an environment where a single pod is running and the pod fails?

A

Brings up a new one

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

What is replacing the replica controller

A

Replication Set

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

What is the command to create a replica controller from a file?

A

kubectl create -f <filename>.yml</filename>

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

What is the command to list the replication controller?

A

kubectl get replicationcontroller

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

What is the command to create a replica set from a file?

A

kubectl create -f <filename>.yml</filename>

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

What is the command to list the replication controller?

A

kubectl get replicaset

17
Q

How does a replica set know what pods to monitor in a cluster with many other pods?

A

selector:
matchLabels:
tier: <label></label>

18
Q

What command updates the replica set after updating the number of replicas in the yaml file?

A

kubectl replace -f <filename>.yml</filename>

19
Q

What command updates the replica set using only a kubectl command?

A

kubectl scale –replicas=<number> -f <filename>.yml</filename></number>

20
Q

What command updates the replica set using only a kubectl command without specifying the filename?

A

kubectl scale –replicas=<number> -f <metadata>
eg. kubectl scale --replicas=<number> -f myapp-replicaset</number></metadata></number>

21
Q

What command allows you to edit the existing replicaset definition file?

A

kubectl edit replicaset <replicaset_name></replicaset_name>

22
Q

What are the 3 fields required for the replicaset spec section?

A

spec:
replicas:
template:
selector:

23
Q

What command returns all K8 obejcts

A

kubectl get all

24
Q

What is the command to see the status of a rollout?

A

k rollout status deployment/<deployment_name></deployment_name>

25
Q

What is the command to see the history of a rollout?

A

k rollout history deployment/<deployment_name></deployment_name>

26
Q

What is the command to rollback a deployment=?

A

k rollout undo deployment/<deployment_name></deployment_name>

27
Q

What is the command to update an image in a deployment?

A

k set image deployment <deployment_name> <container_name>=<image_version></image_version></container_name></deployment_name>

28
Q

What are the spec requirements for creating a NodePort service?

A

spec:
type: NodePort
ports:
- targetPort: <port_number>
port: <port_number>
nodePort: <30000 - 32767></port_number></port_number>

29
Q

How do you link a pod to a service?

A

Pull the labels from the pod definition file and add them under selector

30
Q

What is the command to create a service?

A

k create -f <service-file.yml></service-file.yml>

31
Q

What is the command to see the services?

A

k get services
k get svc

32
Q

What command would you use to get both pods and services?

A

k get pods,svc