Knowledge Check: Kubernetes Concepts Flashcards

1
Q

What is the recommended Kubernetes resource for running applications?

A

Deployment

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

What are some reasons you would prefer to use Deployments rather than “naked” Pods

A
  1. Deployments are compatible with Horizontal Pod Autoscalers
  2. Deployments can reschedule pods that fail
  3. Deployments support rolling updates and rollbacks
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a “naked” pod?

A

Pods that are not managed by a higher-level resource, such as a Deployment

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

Which two kubectl commands that are useful for collecting information about any type of resource that is active in a Kubernetes cluster?

A

Describe

Get

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

True or False: Deployments are compatible with Horizontal Pod Autoscalers

A

True

Explanation
Deployments can be autoscaled using Horizontal Pod Autoscalers, reschedule pods that fail, and perform rolling updates and rollbacks. Naked pods (pods without any higher-level resource managing them) cannot do any of those.

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

True or False: Deployments are unable to reschedule pods that fail?

A

False. Deployments can reschedule failed pods

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

True or False: Deployments support rolling updates and rollbacks

A

True.

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

True or False: A Volume’s lifetime is connected to the lifetime of a pod

A

True.

A Volume’s lifetime is the same as the lifetime of the pod that encloses it

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

True or False: A PersistentVolume’s lifetime is connected to the lifetime of a pod

A

False.

PersistentVolumes have a lifetime independent of any pod allowing the data on a PersistentVolume to be reused by other pods.

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

True or False: Volumes can be shared by multiple containers in a pod, while PersistentVolumes cannot be shared by containers

A

False

Both Volumes and PersistentVolumes can be accessed by all of the containers in the pod enclosing them.

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

True or False: PersistentVolumes are claimed by defining the pod spec in the deployment?

A

False

PersistentVolumes must be claimed by pods using PersistentVolumeClaims.

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

How are PersistentVolumes created?

A

Through PersistentVolumeClaims

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

How is a volume created?

A

Include a volume in a Pod spec

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

You have written a manifest file for a service in Kubernetes. You did not include the type field in the service’s specification. What is the type of the service that will be created?

A

ClusterIP

Explanation
If you don’t specify a type for a service, it will use the default value of ClusterIp. ClusterIp services are accessible only within the cluster. Other types of services can be used to access a service from outside the cluster (NodePort and LoadBalancer) or access services outside the cluster (ExternalName).

/course/introduction-to-kubernetes/multi-container-pods-and-service-discovery/

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

You need to utilize a PersistentVolume for application storage in a Kubernetes cluster. What field of a PersistentVolume can you use to control the number of nodes that can mount the PersistentVolume for reading and writing?

A

accessMode

A PersistentVolumes accessMode field controls how many nodes can mount it for reading and writing. The supported values are ReadWriteOnce, ReadOnlyMany, and ReadWriteMany.

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

What are the supported values for accessMode?

A

ReadWriteOnce
ReadOnlyMany
ReadWriteMany

17
Q

You have a container that requires some custom code to run before the container is ready to start. In Kubernetes, what Pod field should you use to ensure that the code runs before the main application container starts?

A

initContainers

18
Q

A colleague of yours told you they have cordoned a node. When you check the status of the node, which of the following values do you see?

A

SchedulingDisabled

Explanation
When a node is cordoned, it becomes ineligible to schedule new pods to the node. The status of SchedulingDisabled is reported to indicate that a node has been cordoned.

19
Q

What property of a Kubernetes service defines the set of pods that are accessed via the service?

A

The service’s selector

Explanation
The service’s selector defines the pods that are accessed via the service. Any pod that has a label matching the service’s selector will be accessed through the service.

20
Q

You have deployed an application in Kubernetes. The application container exposes port 80. You need to be able to access the application from outside of the cluster. What Kubernetes resource should you use to meet this requirement?

A

A service

21
Q

You have an application that uses a persistent volume in Kubernetes. If an application pod terminates, you would like to have the persistent volume remain but have its data deleted. How can you achieve this with the least amount of effort?

A

This is supported natively because PersistentVolumes can be scrubbed after releasing from a pod.

Explanation
PersistentVolumes can be scrubbed to delete the data stored on the volume without deleting the volume entirely. This is accomplished by using a reclaim policy of recycle. When possible dynamic provisioning of persistent volumes is preferred over the recycle reclaim policy.

22
Q

Which fields are required when writing a Kubernetes YAML manifest file for creating any type of Kubernetes resource?

A

apiVersion
kind
metadata