Quiz Module 7 - Advanced Workloads
Instructions
This quiz contains 30 multiple-choice questions.
Question 1
Which type of workload guarantees that a Pod runs on all nodes in the cluster?
View explanation
Correct answer: DaemonSet
Explanation: A DaemonSet ensures that a Pod runs on all (or some) nodes in the cluster, ideal for logging or monitoring agents.
Question 2
What is a Job in Kubernetes?
View explanation
Correct answer: A workload that creates one or more Pods and guarantees that a certain number terminate successfully
Explanation: A Job is used for one-time tasks that must run once and terminate successfully, such as data processing or backups.
Question 3
What is a CronJob?
View explanation
Correct answer: A workload that creates Jobs on a recurring basis according to a schedule (like cron)
Explanation: A CronJob schedules the execution of Jobs according to a cron format (for example: "0 2 * * *" for every day at 2 AM).
Question 4
What is the main difference between a StatefulSet and a Deployment?
View explanation
Correct answer: StatefulSet guarantees stable identities and individual persistent storage, Deployment is for stateless applications
Explanation: StatefulSets are designed for stateful applications (databases) with stable identities, while Deployments are for stateless applications.
Question 5
What is the schedule format for a CronJob?
View explanation
Correct answer: Cron format: minute hour day month day-of-week
Explanation: The schedule uses the standard cron format: "* * * * *" where each asterisk represents minute, hour, day of month, month, day of week.
Question 6
What is a DaemonSet used for?
View explanation
Correct answer: Deploying system agents such as logging, monitoring, or networking agents on each node
Explanation: DaemonSets are ideal for agents that need to run on each node, such as Fluentd for logs, Prometheus Node Exporter for metrics, or kube-proxy.
Question 7
What is the difference between completions and parallelism in a Job?
View explanation
Correct answer: completions defines the number of required successes, parallelism defines the number of parallel Pods
Explanation: completions specifies how many Pods must terminate successfully, while parallelism controls how many Pods can run simultaneously.
Question 8
What is a headless service in the context of a StatefulSet?
View explanation
Correct answer: A Service with clusterIP: None that returns Pod IPs directly for stable DNS discovery
Explanation: StatefulSets use headless services to enable stable DNS discovery of each Pod (for example: web-0.web-service.default.svc.cluster.local).
Question 9
What is the command to view Jobs?
View explanation
Correct answer: kubectl get jobs
Explanation: kubectl get jobs displays all Jobs and their status (Active, Completed, Failed).
Question 10
What is the command to view CronJobs?
View explanation
Correct answer: kubectl get cronjobs
Explanation: kubectl get cronjobs (or cj) displays all CronJobs and their schedule.
Question 11
What is a Pod Disruption Budget (PDB)?
View explanation
Correct answer: A policy that limits the number of Pods of an application that can be disrupted simultaneously
Explanation: A PDB guarantees that a certain number of Pods remain available during updates or maintenance, ensuring high availability.
Question 12
What is the difference between a Job and a CronJob?
View explanation
Correct answer: A Job runs once, a CronJob creates recurring Jobs according to a schedule
Explanation: A Job executes a one-time task, while a CronJob schedules the recurring execution of Jobs according to a cron schedule.
Question 13
What is the default restartPolicy for a Job?
View explanation
Correct answer: Never or OnFailure
Explanation: Jobs typically use restartPolicy: Never or OnFailure, because they must terminate successfully, not restart indefinitely.
Question 14
What is a StatefulSet used for?
View explanation
Correct answer: Stateful applications like databases, requiring stable identities and persistent storage
Explanation: StatefulSets are designed for applications that require stable identities, guaranteed deployment order, and individual persistent storage per Pod.
Question 15
What is the command to suspend a CronJob?
View explanation
Correct answer: kubectl patch cronjob [name] -p '{"spec":{"suspend":true}}'
Explanation: To suspend a CronJob, use kubectl patch to set suspend: true, which prevents the creation of new Jobs.
Question 16
What is a DaemonSet with nodeSelector?
View explanation
Correct answer: A DaemonSet that runs only on nodes matching the specified selectors
Explanation: A DaemonSet can use nodeSelector to limit execution to certain nodes, useful for agents specific to certain node types.
Question 17
What is the difference between a Job with completions=1 and parallelism=1?
View explanation
Correct answer: completions=1 means one Pod must succeed, parallelism=1 means only one Pod runs at a time
Explanation: completions defines the number of required successes, while parallelism controls the number of Pods that can run simultaneously.
Question 18
What is a StatefulSet with serviceName?
View explanation
Correct answer: A StatefulSet that uses a specified headless service for stable DNS discovery
Explanation: serviceName in a StatefulSet references a headless service that enables stable DNS discovery for each Pod in the StatefulSet.
Question 19
What is the command to view DaemonSets?
View explanation
Correct answer: kubectl get daemonsets
Explanation: kubectl get daemonsets (or ds) displays all DaemonSets and the desired/current number of Pods.
Question 20
What is the command to view StatefulSets?
View explanation
Correct answer: kubectl get statefulsets
Explanation: kubectl get statefulsets (or sts) displays all StatefulSets and their replication status.
Question 21
What is a Job with activeDeadlineSeconds?
View explanation
Correct answer: A Job with a maximum time limit for its execution
Explanation: activeDeadlineSeconds defines the maximum duration in seconds that a Job can run before being automatically terminated.
Question 22
What is the difference between a DaemonSet and a Deployment for scaling?
View explanation
Correct answer: A DaemonSet creates one Pod per node, a Deployment creates a specified number of Pods
Explanation: A DaemonSet guarantees that a Pod runs on each node (or matching nodes), while a Deployment creates a specified number of replicas independently of the number of nodes.
Question 23
What is a CronJob with startingDeadlineSeconds?
View explanation
Correct answer: A CronJob with a time limit to start a Job after the scheduled time
Explanation: startingDeadlineSeconds defines the number of seconds after the scheduled time during which a Job can still be started before being considered missed.
Question 24
What is the command to delete a Job and its Pods?
View explanation
Correct answer: kubectl delete job [name]
Explanation: kubectl delete job deletes the Job and its associated Pods. Use --cascade=orphan to keep the Pods.
Question 25
What is a StatefulSet with podManagementPolicy: Parallel?
View explanation
Correct answer: A StatefulSet that creates and deletes Pods in parallel instead of sequentially
Explanation: By default, StatefulSets create/delete Pods sequentially. Parallel allows doing it in parallel, speeding up operations but losing guaranteed order.
Question 26
What is the command to view a CronJob's history?
View explanation
Correct answer: kubectl get jobs -l job-name=[cronjob-name] to view Jobs created by the CronJob
Explanation: CronJobs create Jobs with specific labels. Use kubectl get jobs with the appropriate labels to view the history.
Question 27
What is a Job with backoffLimit?
View explanation
Correct answer: A Job with a maximum number of attempts before being marked as failed
Explanation: backoffLimit defines the maximum number of times a Job can be retried after a failure before being marked as permanently failed.
Question 28
What is the difference between a StatefulSet and a DaemonSet?
View explanation
Correct answer: StatefulSet creates a specified number of Pods with stable identities, DaemonSet creates one Pod per node
Explanation: StatefulSets create a specified number of replicas with stable identities, while DaemonSets guarantee one Pod on each node.
Question 29
What is a CronJob with concurrencyPolicy: Forbid?
View explanation
Correct answer: A CronJob that prevents creating a new Job if the previous one is still running
Explanation: concurrencyPolicy: Forbid prevents creating a new Job if the previous Job is still running, avoiding simultaneous executions.
Question 30
What is the command to view Pods of a DaemonSet?
View explanation
Correct answer: kubectl get pods -l [selector] where selector matches the DaemonSet's labels
Explanation: Pods created by a DaemonSet have the same labels as the DaemonSet. Use kubectl get pods with the appropriate labels to filter them.
Quiz Result
Congratulations on completing Module 7 Quiz!
Score:
- 25-30 correct answers: Excellent! You master advanced workloads.
- 20-24 correct answers: Very good! Review the concepts where you had difficulties.
- 15-19 correct answers: Good! Review the chapters on StatefulSets, DaemonSets, Jobs, and CronJobs.
- Less than 15: Recommended to review the module before continuing.
Quiz created: December 2024