Skip to main content

Quiz Module 7 - Advanced Workloads

Instructions​

This quiz contains 30 multiple-choice questions.


Question 1​

What type of workload ensures that a Pod runs on all nodes in the cluster?

See 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?

See explanation

Correct answer: A workload that creates one or more Pods and ensures that a certain number successfully complete

Explanation: A Job is used for one-time tasks that need to run once and complete successfully, such as data processing or backups.


Question 3​

What is a CronJob?

See 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 (e.g., "0 2 * * *" for every day at 2 AM).


Question 4​

What is the main difference between a StatefulSet and a Deployment?

See explanation

Correct answer: StatefulSet ensures 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 of a CronJob?

See 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 the month, month, day of the week.


Question 6​

What is a DaemonSet used for?

See explanation

Correct answer: Deploying system agents like 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?

See explanation

Correct answer: completions defines the number of successes required, parallelism defines the number of Pods running in parallel

Explanation: completions specifies how many Pods must successfully complete, while parallelism controls how many Pods can run simultaneously.


Question 8​

What is a headless service in the context of a StatefulSet?

See explanation

Correct answer: A Service with clusterIP: None that directly returns the IPs of the Pods for stable DNS discovery

Explanation: StatefulSets use headless services to allow stable DNS discovery of each Pod (e.g., web-0.web-service.default.svc.cluster.local).


Question 9​

What is the command to view Jobs?

See 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?

See 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)?

See explanation

Correct answer: A policy that limits the number of Pods of an application that can be disrupted simultaneously

Explanation: A PDB ensures 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?

See 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?

See explanation

Correct answer: Never or OnFailure

Explanation: Jobs typically use restartPolicy: Never or OnFailure, as they need to complete successfully, not restart indefinitely.


Question 14​

What is a StatefulSet used for?

See 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?

See 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 new Jobs from being created.


Question 16​

What is a DaemonSet with nodeSelector?

See 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 types of nodes.


Question 17​

What is the difference between a Job with completions=1 and parallelism=1?

See 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 successes required, while parallelism controls the number of Pods that can run simultaneously.


Question 18​

What is a StatefulSet with serviceName?

See 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 allows stable DNS discovery of each Pod in the StatefulSet.


Question 19​

What is the command to view DaemonSets?

See 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?

See 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?

See 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?

See explanation

Correct answer: A DaemonSet creates one Pod per node, a Deployment creates a specified number of Pods

Explanation: A DaemonSet ensures that a Pod runs on each node (or nodes matching selectors), while a Deployment creates a specified number of replicas regardless of the number of nodes.


Question 23​

What is a CronJob with startingDeadlineSeconds?

See 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?

See 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?

See 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 this to be done in parallel, speeding up operations but losing guaranteed order.


Question 26​

What is the command to view the history of a CronJob?

See explanation

Correct answer: kubectl get jobs -l job-name=[cronjob-name] to see the 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?

See 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?

See 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 ensure one Pod on each node.


Question 29​

What is a CronJob with concurrencyPolicy: Forbid?

See explanation

Correct answer: A CronJob that prevents a new Job from being created if the previous one is still running

Explanation: concurrencyPolicy: Forbid prevents a new Job from being created if the previous Job is still running, avoiding simultaneous executions.


Question 30​

What is the command to view the Pods of a DaemonSet?

See explanation

Correct answer: kubectl get pods -l [selector] where selector corresponds to 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 the 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 on: December 2024