Knowledge Check: Kubernetes Concepts Flashcards
What is the recommended Kubernetes resource for running applications?
Deployment
What are some reasons you would prefer to use Deployments rather than “naked” Pods
- Deployments are compatible with Horizontal Pod Autoscalers
- Deployments can reschedule pods that fail
- Deployments support rolling updates and rollbacks
What is a “naked” pod?
Pods that are not managed by a higher-level resource, such as a Deployment
Which two kubectl commands that are useful for collecting information about any type of resource that is active in a Kubernetes cluster?
Describe
Get
True or False: Deployments are compatible with Horizontal Pod Autoscalers
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.
True or False: Deployments are unable to reschedule pods that fail?
False. Deployments can reschedule failed pods
True or False: Deployments support rolling updates and rollbacks
True.
True or False: A Volume’s lifetime is connected to the lifetime of a pod
True.
A Volume’s lifetime is the same as the lifetime of the pod that encloses it
True or False: A PersistentVolume’s lifetime is connected to the lifetime of a pod
False.
PersistentVolumes have a lifetime independent of any pod allowing the data on a PersistentVolume to be reused by other pods.
True or False: Volumes can be shared by multiple containers in a pod, while PersistentVolumes cannot be shared by containers
False
Both Volumes and PersistentVolumes can be accessed by all of the containers in the pod enclosing them.
True or False: PersistentVolumes are claimed by defining the pod spec in the deployment?
False
PersistentVolumes must be claimed by pods using PersistentVolumeClaims.
How are PersistentVolumes created?
Through PersistentVolumeClaims
How is a volume created?
Include a volume in a Pod spec
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?
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/
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?
accessMode
A PersistentVolumes accessMode field controls how many nodes can mount it for reading and writing. The supported values are ReadWriteOnce, ReadOnlyMany, and ReadWriteMany.
What are the supported values for accessMode?
ReadWriteOnce
ReadOnlyMany
ReadWriteMany
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?
initContainers
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?
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.
What property of a Kubernetes service defines the set of pods that are accessed via the service?
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.
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 service
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?
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.
Which fields are required when writing a Kubernetes YAML manifest file for creating any type of Kubernetes resource?
apiVersion
kind
metadata