Orchestration: Kubernetes Flashcards

1
Q

What to all install when installing K8s?

A
  1. kubectl
  2. K8s Master
  3. Worker node agents
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to run a pod using the soon to be deprecated method?

A

kubectl run mywebserver –image=nginx

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

How to exec into a pod?

A

kubectl exec -it mywebserver-xyz – bash

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

How to delete a pod?

A

kubectl delete pod mywebserver-xyz

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

What is an object?

A

Object is a record of intent, once created K8s will work to ensure that the object exists.

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

How to create a K8s object via YAML configuration file?

A

kubectl apply -f file.yaml

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

How to delete a K8s object via YAML configuration file?

A

kubectl delete -f file.yaml

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

What is a the purpose of a ReplicaSet?

A

To maintain a set of replica pods

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

What are the two states of pods in a ReplicaSet?

A

Current and Desired

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

How to view the labels of pods?

A

kubectl get pods –show-labels

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

What does the “selector / matchLabels” section do in ReplicaSets?

A

Determines which label is used to count the number of current pods for the ReplicaSet

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

What is the main difference between a ReplicaSet and a Deployment?

A

Deployment sits on top of ReplicaSets, with features like rolling out updates and rolling back.

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

How does a Deployment rollout changes?

A

Creates a new ReplicaSet, once running, deletes old ReplicaSet.

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

Equivalent K8s command for docker inspect?

A

kubectl describe resource_type resource_name

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

How to get the rollout history for a deployment?

A

kubectl rollout history deployment.v1.apps/my_deployment

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

How to get information about a specific deployment revision?

A

kubectl deployment history deployment.v1.apps/my_deployment –revision=1

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

What is the default max unavailable pods and maximum surge during a deployment rollout?

A

25%

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

For deployment rollout, which parameter determines the max number of pods that can be scheduled above the original number of pods?

A

maxSurge

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

For deployment rollout, which parameter determines the maximum amount of pods that can be unavailable during the deployment?

A

maxUnavailable

20
Q

Two different ways of getting information about a resource (pod/deployment/replicaset/etc)

A

kubectl get pod my_pod -o yaml

kubectl describe pod my_pod

21
Q

How to create a new basic K8s secret with a literal value?

A

kubectl create secret generic my_secret –from-literal=dbpass=password123

22
Q

How to create a new basic K8s secret from a file?

A

kubectl create secret generic my_secret –from-file=./file.txt

23
Q

What are two approaches to make secrets available to Pods?

A

Environment Variables

Volumes

24
Q

How to create a ConfigMap

A

kubectl create configmap my_config –from-literal=memory=2048m

25
What does a Kubernetes service do?
Acts as a load balancer and a single point of contact for pods to communicate to downstream pods
26
What are the four types of K8s services?
ClusterIP NodePort LoadBalancer ExternalName
27
What are the 3 characteristics of ClusterIP service?
Internal Cluster IP address is assigned to the service Only reachable from inside the cluster Default service type
28
What is the NodePort service?
K8s opens a random port on each worker node | Is accessible over the internet
29
What are the 4 networking considerations for K8s?
1. Container to container 2. Pod to Pod 3. Pod to Service 4. Internet to Service
30
How does container to container communication occur in K8s Networking Model?
Using localhost and port numbers for other containers in the same pod
31
How does pod to pod communication occur in K8s Networking Model?
Virtual interfaces on the pod communicating via a bridge
32
How does pod to service communication occur in K8s Networking Model?
Service creates an IP or DNS endpoint which can be used to route traffic to
33
How does internet to service communication occur in K8s Networking Model?
Using an Ingress controller (like Traefik)
34
What is a Liveness Probe?
Used to detect the state (healthy/unhealthy) of an application, and take actions such as restarting
35
What is Readiness Probe?
A healthcheck that will wait for new pods before serving traffic or trying to restart the pod
36
How does a Readiness Probe differ from Liveness Probe?
Liveness is to know when to restart a container | Readiness is to know when it can start accepting traffic
37
What is a K8s DaemonSet?
Similar to docker global replicated services. One pod per node, and new nodes get the pod
38
What are Taints?
Used to repel pods from a specific node ie, prevents a pod from running on a specific node
39
What is a Toleration?
It's a pass for a pod to be deployed to a tainted node
40
What is the command to taint a node?
kubectl taint node node_name key=value:NoSchedule
41
What is the purpose of the key and value in the taint command?
Used to issue a toleration for a pod for a specific taint key:value
42
What is a Selector in K8s?
Used to filter on specific labels
43
How to get all pods with the label of env=prod?
kubectl get pods -l env=prod
44
What is a resource Request?
The amount of resources that a pod is guaranteed to get
45
What is a resource Limit?
Makes sure that the resource does not go above a specific value
46
How to view the Requests and Limits for a specific node?
kubectl describe node my_node
47
What are the three states of Requests/Limits?
Guaranteed Burstable Best Effort