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
Q

What does a Kubernetes service do?

A

Acts as a load balancer and a single point of contact for pods to communicate to downstream pods

26
Q

What are the four types of K8s services?

A

ClusterIP
NodePort
LoadBalancer
ExternalName

27
Q

What are the 3 characteristics of ClusterIP service?

A

Internal Cluster IP address is assigned to the service
Only reachable from inside the cluster
Default service type

28
Q

What is the NodePort service?

A

K8s opens a random port on each worker node

Is accessible over the internet

29
Q

What are the 4 networking considerations for K8s?

A
  1. Container to container
  2. Pod to Pod
  3. Pod to Service
  4. Internet to Service
30
Q

How does container to container communication occur in K8s Networking Model?

A

Using localhost and port numbers for other containers in the same pod

31
Q

How does pod to pod communication occur in K8s Networking Model?

A

Virtual interfaces on the pod communicating via a bridge

32
Q

How does pod to service communication occur in K8s Networking Model?

A

Service creates an IP or DNS endpoint which can be used to route traffic to

33
Q

How does internet to service communication occur in K8s Networking Model?

A

Using an Ingress controller (like Traefik)

34
Q

What is a Liveness Probe?

A

Used to detect the state (healthy/unhealthy) of an application, and take actions such as restarting

35
Q

What is Readiness Probe?

A

A healthcheck that will wait for new pods before serving traffic or trying to restart the pod

36
Q

How does a Readiness Probe differ from Liveness Probe?

A

Liveness is to know when to restart a container

Readiness is to know when it can start accepting traffic

37
Q

What is a K8s DaemonSet?

A

Similar to docker global replicated services. One pod per node, and new nodes get the pod

38
Q

What are Taints?

A

Used to repel pods from a specific node ie, prevents a pod from running on a specific node

39
Q

What is a Toleration?

A

It’s a pass for a pod to be deployed to a tainted node

40
Q

What is the command to taint a node?

A

kubectl taint node node_name key=value:NoSchedule

41
Q

What is the purpose of the key and value in the taint command?

A

Used to issue a toleration for a pod for a specific taint key:value

42
Q

What is a Selector in K8s?

A

Used to filter on specific labels

43
Q

How to get all pods with the label of env=prod?

A

kubectl get pods -l env=prod

44
Q

What is a resource Request?

A

The amount of resources that a pod is guaranteed to get

45
Q

What is a resource Limit?

A

Makes sure that the resource does not go above a specific value

46
Q

How to view the Requests and Limits for a specific node?

A

kubectl describe node my_node

47
Q

What are the three states of Requests/Limits?

A

Guaranteed
Burstable
Best Effort