Cluster Management Flashcards

1
Q

What is meant by “Stacked Etcd?”

A

Each control plane node has its own Etcd instance in a cluster with multiple control plane nodes.

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

What is meant by “External Etcd?”

A

In a Kubernetes cluster with multiple control plane nodes, Etcd for each control plane runs on a completely separate node, and there may be multiple Etcd nodes for multiple control plane nodes.

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

What command would you use to drain a node called “node1” in a K8s cluster?

A

kubectl drain node1

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

How would you drain a node that is running DaemonSet pods?

A

kubectl drain <node-name> --ignore-daemonsets</node-name>

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

What is a DaemonSet?

A

In Kubernetes, a DaemonSet is a pod tied specifically to a node.

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

After maintenance of a K8s node is complete, what command would you use to tell Kubernetes that it can run pods again?

A

kubectl uncordon <node-name></node-name>

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

What command would you use to see which node each pod is running on?

A

kubectl get pods -o wide

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

What command would you use to return a node to service after maintenance?

A

kubectl uncordon <node-name></node-name>

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

How would you backup Etcd?

A

ETCDCTL_API=3 etcdctl –endpoints $ENDPOINT snapshot save <file-name></file-name>

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

How would you restore Etcd?

A

ETCDCTL_API=3 etcdctl snapshot restore <file-name></file-name>

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

What command can you use to allow Pods to be scheduled on a previously-drained node after Node maintenance is complete?

A. kubectl undrain
B. kubectl enable
C. kubectl uncordon
D. kubectl add node

A

C. kubectl uncordon

This command will allow Pods to be scheduled on a previously-drained Node.

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

What software does Kubernetes use to store data about the state of the cluster?

A. kube-system
B. Redis
C. MySQL
D. Etcd

A

D. Etcd

Etcd is the Backend data store or Kubernetes.

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

Which tool provides a command-line interface for Kubernetes?

A. kubeadm
B. Minikube
C. kubectl
D. k3s

A

C. kubectl

kubectl provides a command-line interface to the Kubernetes API.

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

How can you make Kubernetes highly available?

A. Have one control plane node.

B. Use HTTPS for Kubernetes API Server traffic.

C. Have multiple control plane nodes.

D. Have multiple replicas of each Application’s Pod.

A

C. Have multiple control plane nodes.

An HA setup for Kubernetes involved multiple control plane nodes.

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

Which command allows you to upgrade control plane components?

A. kubeadm upgrade plan

B. kubeadm upgrade apply

C. kubeadm version set

D. kubectl upgrade

A

B. kubeadm upgrade apply

This command will upgrade the control plane.

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

Which tool can help you perform a Kubernetes upgrade?

A. kubeupgrd

B. kube-scheduler

C. kubeadm

D. kube-controller-manager

A

C. kubeadm

kubeadm includes functionality to help you upgrade Kubernetes clusters.

17
Q

Which command is used to safely evict your pods from a node before maintenance on the node?

A. kubectl delete node.

B. kubectl drain

C. kubectl cordon

D. kubectl remove

A

B. kubectl drain

kubectl drain is used to take a node down for maintenance.

18
Q

Which tool(s) allow you to create Kubernetes clusters?

Choose 2

A. Helm

B. kubeadm

C. kubectl

D. Minikube

A

B. kubeadm
D. Minikube

kubeadm allows you to build Kubernetes clusters.

Minikube allows you to easily create single-node clusters.

19
Q

Which command-line tool allows you to interact with Etcd and perform backups?

A. kubeadm

B. etcdctl

C. etcdadm

D. kube-backup

A

B. etcdctl

etcdctl is the command-line tool for Etcd.

20
Q

Which of the following are options for a highly-available Etcd architecture?

Choose 2

A. Layered Etcd

B. External Etcd

C. Stacked Etcd

D. Single Etcd Server

A

B. External Etcd
C. Stacked Etcd

External etcd, or managing Etcd separately from other control plane components, is one option for an HA setup.

Stacked etcd, or managing Etcd alongside other control plane components, is one option for an HA setup.

21
Q

What is kubectl?

A

kubectl is a command-line tool that allows your to interact with Kubernetes. kubectl uses the Kubernetes API to communicate with the cluster and carry out your commands.

You can use kubectl to deploy applications, inspect and manage cluster resources, and view logs.

22
Q

What are the options for the ‘kubectl get’ command?

A

-o : set output format
–sort-by : sort output using a JSONPath expression
–selector : filter results by label

$ kubectl get <object-type> <object-name> -o <output> --sort-by <JSONPath> --selector <selector></selector></JSONPath></output></object-name></object-type>

23
Q

What does kubectl describe do?

A

Allows you to get detailed information about specific Kubernetes objects using kubectl describe.

$ kubectl describe <object-type> <object-name></object-name></object-type>

24
Q

What does kubectl create do?

A

Use ‘kubectl create’ to create objects.

Supply a YAML file with -f to create an object from a YAML descriptor stored in the file.

$ kubectl create -f <filename></filename>

If you try to use ‘kubectl create’ in a cluster that contains an object with the same name, you will get an error.

25
Q

What does ‘kubectl apply’ do?

A

‘kubectl apply’ is similar to ‘kubectl create.’

However, if you use ‘kubectl apply’ on an object that already exists, it will modify the existing object, if possible.

So you can use ‘kubectl apply’ to create a new object or modify an existing object.

$ kubectl apply -f <filename></filename>

26
Q

What does ‘kubectl delete’ do?

A

Use ‘kubectl delete’ to delete objects from the cluster.

$ kubectl delete <object-type> <object-name></object-name></object-type>

27
Q

What does ‘kubectl exec’ do?

A

‘kubectl exec’ can be used to run commands inside containers. Keep in mind that in order for a command to succeed, the necessary software must exist within the container to run it.

$ kubectl exec <pod-name> -c <container-name> -- <command></command></container-name></pod-name>

Note: Use the -c <container-name> option if your pod has more than one container</container-name>

28
Q

What does ‘kubectl api-resources’ do?

A

‘kubectl api-resources’ lists all available resource types.

29
Q

What does the following command provide?

kubectl get pods -o wide –sort-by .spec.nodeName

A

Shows a list pods grouped by the nodes that they’re running on.

-o wide : shows additional information about each pod, such as the node the pod is running on and

–sort-by .spec.nodeName : groups pods running on the same node together

30
Q

What does the following command provide?

kubectl get pods -n kube-system –selector k8s-app=calico-node

A

Answer later

31
Q

What does ‘kubectl get’ do?

A

Lists objects in the Kubernetes cluster.

32
Q

How would you get information about a specific object in a Kubernetes cluster?

A

kubectl get <object-name></object-name>