Kubernetes Flashcards

1
Q
  1. True or False? In a pod .yaml file, resource limit of cpu: 0.1 is allowed.
A

True. This can also be written as 100m.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
  1. True or False? A secret can be visible to only one container in a pod.
A

True. This may be done for security reason, such as this example: https://kubernetes.io/docs/concepts/configuration/secret/#use-case-secret-visible-to-one-container-in-a-pod

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
  1. What are four main types of services?
A

-Cluster IP
(Expose the service on a cluster-internal IP, not exposed to anything external to Kubernetes cluster)

-NodePort
(Expose the service on each Node’s IP at a static port. External callers can call the service)

-LoadBalancer
(Provision an external IP to act as a load balancer for the service. Exposes a service to external callers)

-ExternalName
(Maps a service to a DNS name. The service doesn’t change IP addresses, but it routes traffic to an external service that does have a dynamic IP)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
  1. What kubectl command will give you information such as what node and IP address a pod is on? And any failure events?
A

kubectl describe pod my-nginx

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
  1. What are some of the benefits of Deployments?
A

Deployments support

zero-downtime updates by creating and destroying replica

provide rollback functionality

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
  1. What is the name of the AWS volume type?
A

awsElasticBlockStore

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
  1. What command will create three pod replicas?
A

kubectl scale deployment my-deployement –replicas=3

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
  1. What specifies that data in a storage provider should not be erased if a PVC is deleted?
A

persistentVolumeReclaimPolicy: Retain

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
  1. What does the spec.selector.matchLabels key in a Pod .yaml do?
A

Queries for a template with the specified label in order to use that pod template

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
  1. What command creates a ConfigMap from an env file?
A

kubectl create configmap [configmap-name] –from-env-file=[path-to-file]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
  1. What is a LimitRange?
A

A LimitRange specifies min and max limits on cpu and memory for pods in a namespace. This prevents pods from not being given a limit and consuming too much memory, thus causing other pods to fail on a node.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
  1. What access mode allows only one client (i.e. one pod) to write to a PV?
A

-ReadWriteOnce

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q
  1. How does Kubernetes accomplish a no downtime deployment?
A

It spins up new pods and routes traffic to them, then subsequently destroys the old pods that no longer have traffic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
  1. What command can be used to externally expose a port on a clusterIP service?
A

kubectl port-forward service/[service-name] 8080

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
  1. What are some zero-downtime deployment options that kubernetes can facilitate?
A

Blue-Green and Canary deployments, among others

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q
  1. What are the two types of Kubernetes probes?
A

Liveness and readiness

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q
  1. What is the annotations.last-applied-configuration.key in a .yaml file?
A

It gives details of the resource’s configurations.

This allows changes to be made to a Pod using kubectl apply

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q
  1. What is a StatefulSet?
A

A StatefulSet manages the following of a set of pods

1) deployment and
2) scaling

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q
  1. What happens to a scheduled pod that cannot have its resource requests met by a node?
A

It remains in the PENDING state.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q
  1. What is a risk of using a hostPath volume?
A

It is dependent on the host. If the host dies, the data is inaccessible and potentially lost.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q
  1. What command will show all running pods, replicasets, and deployments?
A

kubectl get all

22
Q
  1. How are secrets stored on a node?
A

tmpfs

23
Q
  1. Will ‘kubectl delete pod [pod-name]’ remove and recreate a pod, or just remove?
A

It will remove and recreate if there is an active deployment

24
Q
  1. True or False? A pod can have multiple volumes attached to it?
A

True

25
Q
  1. What is gcePersistentDisk fsType?
A

It is the file system type to use for the volume.

26
Q
  1. What does Secret type:Opaque signify?
A

The secret may contain unstructured data. There are no constraints on the data.

27
Q
  1. What is the name of the Azure volume type?
A

azureFile

28
Q
  1. What is the difference between a memory request (spec.containers[].resources.requests.memory) and a memory limit (spec.containers[].resources.limits.memory) in a pod .yaml?
A

A pod can use more memory than the memory request amount. However, if the memory request amount is higher than the available memory on the node, the pod will throw an Out Of Memory error.

A memory limit is the maximum amount of memory that a pod will be allowed to use, even if the node has more available.

29
Q
  1. If a pod has a memory request of 512MiB and a memory limit of 1 GiB, how many pods of this type could be run on a node with 2 GiB of avaiable memory?
A
  1. As the docs say: “A Container is guaranteed to have as much memory as it requests, but is not allowed to use more memory than its limit”. https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/
30
Q
  1. What field in a StorageClass .yaml determines what volume plugin is used for creating PVs?
A

provisioner

31
Q
  1. What command will show you the details of the secret with name: pid-acct?
A

kubectl describe secrets/pid-acct

32
Q
  1. What kind of volume is useful for sharing transient data between two containers running on a pod?
A

emptyDir. This directory will be tied to the lifecycle of the pod.

33
Q
  1. What command will show you the details of all ConfigMaps?
A

kubectl get cm

34
Q
  1. What does the command ‘kubectl get deployments -l tier=frontend’ do?
A

It lists all deployements with label: tier: frontend

35
Q
  1. True or False? A ConfigMap can be loaded through a volume?
A

True. In the pod .yaml file, specify spec.volumes and spec.spec.containers.volumeMounts to point to the appropriate ConfigMap

36
Q
  1. True or False? Information stored as a Secret is available to pods on all nodes whether the pod requests it or not.
A

False. The pod has to specifically request the Secret. This reduces the risk of an attacker getting access to the information contained in a secret.

37
Q
  1. Which of the following is a cluster-wide storage unit provisioned by an administrator and has a lifecycle independent of pods?
A

PersistentVolume. (A pod uses a PersistentVolumeClaim to connect to the persistent volume.)

38
Q
  1. What flag in the yaml file will deny a container the ability to write to a volume?
A

volumeMounts.readOnly: true

39
Q
  1. What is the difference between port, targetPort, and nodePort keys in a NodePort service .yaml?
A

targetPort is the port the container is running on

port is the port the service is exposed on in the cluster

nodePort is the port made avaiable to external consumers of the service.

40
Q
  1. What command will show any limits placed on a deployment?
A

kubectl describe deployment [deployment-name]

41
Q
  1. What two commands can be used to create a service from file my.service.yml?
A

kubectl apply -f my.service.yml

kubectl create -f my.service.yml

42
Q
  1. What command will show a pod’s .yaml file?
A

kubectl get pod [pod-name] -o yaml

43
Q
  1. What .yaml key will ensure a pod does NOT get any traffic for X amount of seconds after deployment?
A

minReadySeconds

44
Q
  1. What command will delete a service created from my.service.yml?
A

kubectl delete -f my.service.yml

45
Q
  1. What is the acceptable naming convention for port names?
A

Port names must only contain lowercase alphanumeric characters and ‘-‘. Port names must also start and end with an alphanumeric character.

46
Q
  1. What is a container MountPath?
A

The directory where the volume storage resides.

47
Q
  1. What entity facilitates dynamic provisioning of Persistent Volumes?
A

Storage Classes. These can be used to provision Persistent Volumes programatically instead of having an administrator create the PV.

48
Q
  1. What is the default binding mode for a StorageClass?
A

Immediate. This means that volume binding and dynamic provisioning occur on creating of the PVC

49
Q
  1. What command creates a ConfigMap in Kubernetes from a config file?
A

kubectl create configmap [configmap-name] –from-file=[path-to-file]

50
Q
  1. What flag controls when Kubernetes pulls an image?
A

imagePullPolicy