Core Concepts Flashcards

1
Q

What are the Master Node’s responsibilities?

A

Manage, plan, schedule, and monitor nodes

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

What are the Worker Node’s responsibilities?

A

Host application as containers

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

What are the Master Node’s components known as?

A

The control plane

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

What is the primary management component of Kubernetes?

A

kube-apiserver

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

What agent runs on each node of the cluster and listens for instructions the kube-apiserver?

A

kubelet

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

What service ensures rules are in place on the worker nodes to allow the containers running on them to reach each other?

A

kube-proxy

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

What is ETCD?

A

A distributed reliable key-value store that is simple, secure, and fast

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

What is the command to list all keys used by K8?

A

kubectl exec etcd-master –n kube-system etcdctl get / –prefix –keys-only

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

What are the 6 steps required for a change in K8?

A
  1. Authenticate User
  2. Validate Request
  3. Retrieve Data
  4. Update ETCD
  5. Scheduler
  6. Kubelet
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the controller’s responsibilities?

A

Monitor the state of various components within the system and work towards bringing the whole system to the desired functioning state.

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

What is the node-monitor-grace-period default value?

A

40s

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

What is the node-eviction-rate default value?

A

5m

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

What is the node-monitor-period default value?

A

5s

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

How does the scheduler assign pods?

A

The scheduler looks at each pod and tries to find the best node for it in two steps:
1. Filter out the nodes that do not fit the profile for the pod. eg. resource limitations
2. The scheduler then ranks the pods to identify the best fit for the pod by using a priority function to rank the nodes on a scale of 0-10

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

What are the responsibilities of the Kubelet?

A
  • Register Node
  • Create Pods
  • Monitor Node and Pods
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is kube-proxy and what is it’s job?

A

A process that runs on each node in the K8 Cluster. It’s job is to look for new services and every time a new service is created, it creates the appropriate rules on each node to forward traffic to those services to the backend pods.

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

What is a pod?

A

A single instance of an application. A pod is the smallest object you can create in K8.

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

What is the smallest object you can create in K8?

A

A pod

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

Can a single pod have multiple containers?

A

Yes

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

What is the command to run an image in a pod?

A

k run <name> --image <image_name></image_name></name>

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

What is the command to list pods?

A

k get pods

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

What are the top level properties that are required for a K8 YAML file?

A

apiVersion:
kind:
metadata:
spec:

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

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

A

k describe pod <pod_name></pod_name>

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

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

A

kubectl run <name> --image=<image> --dry-run=client -o yaml > pod.yaml</image></name>

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

What is the command to edit the YAML for an existing pod?

A

k edit pod <pod_name></pod_name>

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

What is the benefit of using a replication set with a single node?

A

If the pod fails, a new one will automatically be brought up. The replication set will also allow you to load balance and scale.

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

What is the command to list nodes?

A

kubectl get nodes

28
Q

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

A

kubectl describe node

29
Q

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

A

kubectl apply -f pod.yml

30
Q

What is the command to delete a pod?

A

kubectl delete pod <pod_name></pod_name>

31
Q

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

A

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

32
Q

What is the command to list the replica set?

A

kubectl get replicaset

33
Q

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

A

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

34
Q

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

A

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

35
Q

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

A

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

36
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>

37
Q

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

A

kubectl edit replicaset <replicaset_name></replicaset_name>

38
Q

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

A

spec:
replicas:
template:
selector:

39
Q

What command returns all K8 obejcts

A

kubectl get all

40
Q

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

A

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

41
Q

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

A

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

42
Q

What is the command to rollback a deployment?

A

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

43
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>

44
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>
selector:
app: myapp
type: frontend</port_number></port_number>

45
Q

What are the spec requirements for creating a ClusterIP service?

A

spec:
type: ClusterIP
ports:
- targetPort: <port_number>
port: <port_number>
selector:
app: myapp
type: frontend</port_number></port_number>

46
Q

What are the spec requirements for creating a LoadBalancer service?

A

spec:
type: LoadBalancer
ports:
- targetPort: <port_number>
port: <port_number>
nodePort: <30000 - 32767>
selector:
app: myapp
type: frontend</port_number></port_number>

47
Q

How do you link a pod to a service?

A

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

48
Q

What is the command to create a service?

A

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

49
Q

What is the command to see the services?

A

k get services
k get svc

50
Q

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

A

k get pods,svc

51
Q

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

A

k get pods,svc

52
Q

What are the 4 types of K8 services?

A
  • ClusterIP
  • NodePort
  • LoadBalancer
  • ExternalName
53
Q

What is the valid range for a nodePort?

A

30000 - 32767

54
Q

What is the namespace for pods and services that are created for internal K8 purposes?

A

kube-system

55
Q

What is the namespace for resources that should be made available to all users?

A

kube-public

56
Q

What is the primary reasons for creating different namespaces?

A

Isolation, differing policies, resource allocation

57
Q

How do you allow a pod in one namespace to reach a pod in another cluster?

A

Append the namespace to the service. eg. If you are trying to reach mysql in the dev namespace you would write the following:
mysql.connect(“db-service.dev.svc.cluster.local”)

58
Q

What is the command to list pods in a different namespace?

A

k get pods –namespace=<namespace>
k get pods --n=<namespace></namespace></namespace>

59
Q

What is the declaritive command to create a pod in a specific namespace?

A

k create -f <pod.yaml> --namespace=<namespace>
k create -f <pod.yaml> --n=<namespace></namespace></pod.yaml></namespace></pod.yaml>

60
Q

How would you define a namespace in a pod definition file?

A

metadata:
name: <pod_name>
namespace: <namespace></namespace></pod_name>

61
Q

How do you create a manifest for a namespace?

A

apiVersion: v1
kind: Namespace
metadata:
name: <namespace></namespace>

62
Q

What is the imperative command to create a namespace?

A

k create namespace <namespace_name></namespace_name>

63
Q

What is the command to change the default namespace you are working with?

A

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

64
Q

What is the command to list pods in all namespaces?

A

k get pods –all-namespaces

65
Q

How do you limit resources for a namespace in a manifest?

A

apiVersion: v1
kind: ResourceQuota
metadata:
name: computer-quota
namespace: dev
spec:
hard:
pods: “10”
requests.cpu: “4”
requests.memory: “5Gi”
limits.cpu: “10”
limits.memory: 10Gi

66
Q

What is the command to list namespaces?

A

k get namespace
k get ns

67
Q

Should you use an imperative or declarative approach to save time when the exam asks you to execute a simple task?

A

Imperative