Exploring Daemon Sets and Cron
Jobs
Janakiram MSV
Analyst | Advisor | Architect
Janakiram & Associates
Google Developer Expert
@janakiramm
Objectives
â—Ź Recap of Kubernetes Controllers
â—Ź What are Daemon Sets?
â—Ź Daemon Sets vs. Replica Sets
â—Ź Use Cases for Daemon Sets
â—Ź Configuring Run to Completion Jobs
â—Ź Scheduling Jobs with Cron
Kubernetes Controllers
â—Ź Replica Sets
â—Ź Deployments
â—Ź Stateful Sets
â—Ź Daemon Sets
â—Ź Jobs (One time)
â—Ź Cron Jobs
Overview of Daemon Set
â—Ź Daemon Set runs a copy of a pod on every node in a Kubernetes
cluster
â—Ź Daemon Set and Replica Set are similar but have different use cases
â—Ź New nodes automatically gets a Daemon Set pod
â—Ź When a node is removed, the Daemon Set pod will not be rescheduled
Total number of pods in the Daemon Set == The number of nodes in cluster
Daemon Set vs Replica Set
Replica Set
Count = 6
P1
P2
P3
P4
P5
P6
Node 1 Node 2 Node 3
Replica Set
Daemon Set vs Replica Set
Daemon Set
P1 P2 P3
Node 1 Node 2 Node 3
Daemon Set
Daemon Set Use Cases
â—Ź Logging Aggregators
â—Ź Monitoring
â—Ź Load Balancers / Reverse Proxies / API Gateways
â—Ź Generic background job that needs to be run on each
node
Demo
Exploring Daemon Set
Jobs in Kubernetes
â—Ź There are two types of job controllers in Kubernetes
â—‹ One time / Run on completion
â—‹ Scheduled Jobs
â—Ź Both are extremely useful in performing batch operations
â—Ź Jobs complement other controllers like Replica Set and
Daemon Set
Run to Completion Jobs
â—Ź Each Job creates one or more pods and ensures that they are
successfully terminated
â—Ź If a pod or node fails during the execution, job controller will restart or
reschedules the pod
â—Ź Job can also be used to run multiple pods in parallel
â—Ź A job can be scaled up using the kubectl scale command
● Job’s spec may define the parallelism value for running multiple pods in
parallel
Use case for Jobs
â—Ź One time, initialization of resources
â—‹ Databases
â—‹ File Systems
â—‹ Cache
â—‹ Configuration
â—Ź Multiple workers to process messages in a queue
Demo
Using Run to Complete Jobs
Configuring Cron Jobs
â—Ź A Cron Job manages time based Jobs
â—‹ Once at a specified point in time
â—‹ Repeatedly at a specified point in time
â—Ź Each Cron Job is similar to one line of a crontab (cron table) file
â—Ź A typical use cases include
â—‹ Schedule a job execution at a given point in time.
â—‹ Create a periodic job
â–  Database backup
â–  Sending emails
Works only on clusters with --runtime-config=batch/v2alpha1=true
Demo
Using Cron Jobs
Upcoming Webinar
Tips and Tricks of Using Kubectl, the Kubernetes CLI
9AM PST, Thursday, June 29th
Kubectl the command line tool for accessing the Kubernetes cluster. Written in Go
language, this nifty tool offers powerful functionality. This webinar will show you
how to turn Kubectl into a swiss army knife for performing a variety of functions. We
will uncover the hidden gems of the Kubernetes CLI.
Register at kube.live for the upcoming webinars
â—Ź Unleashing the power of Kubectl
â—Ź Kubectl tips & tricks
â—Ź Hidden gems of Kubernetes CLI
Thank You!
Send your Feedback / Questions / Comments
jani@janakiram.com

Kubernetes Webinar Series - Exploring Daemon Sets and Jobs

  • 1.
    Exploring Daemon Setsand Cron Jobs Janakiram MSV Analyst | Advisor | Architect Janakiram & Associates Google Developer Expert @janakiramm
  • 2.
    Objectives â—Ź Recap ofKubernetes Controllers â—Ź What are Daemon Sets? â—Ź Daemon Sets vs. Replica Sets â—Ź Use Cases for Daemon Sets â—Ź Configuring Run to Completion Jobs â—Ź Scheduling Jobs with Cron
  • 3.
    Kubernetes Controllers â—Ź ReplicaSets â—Ź Deployments â—Ź Stateful Sets â—Ź Daemon Sets â—Ź Jobs (One time) â—Ź Cron Jobs
  • 4.
    Overview of DaemonSet â—Ź Daemon Set runs a copy of a pod on every node in a Kubernetes cluster â—Ź Daemon Set and Replica Set are similar but have different use cases â—Ź New nodes automatically gets a Daemon Set pod â—Ź When a node is removed, the Daemon Set pod will not be rescheduled Total number of pods in the Daemon Set == The number of nodes in cluster
  • 5.
    Daemon Set vsReplica Set Replica Set Count = 6 P1 P2 P3 P4 P5 P6 Node 1 Node 2 Node 3 Replica Set
  • 6.
    Daemon Set vsReplica Set Daemon Set P1 P2 P3 Node 1 Node 2 Node 3 Daemon Set
  • 7.
    Daemon Set UseCases â—Ź Logging Aggregators â—Ź Monitoring â—Ź Load Balancers / Reverse Proxies / API Gateways â—Ź Generic background job that needs to be run on each node
  • 8.
  • 9.
    Jobs in Kubernetes â—ŹThere are two types of job controllers in Kubernetes â—‹ One time / Run on completion â—‹ Scheduled Jobs â—Ź Both are extremely useful in performing batch operations â—Ź Jobs complement other controllers like Replica Set and Daemon Set
  • 10.
    Run to CompletionJobs ● Each Job creates one or more pods and ensures that they are successfully terminated ● If a pod or node fails during the execution, job controller will restart or reschedules the pod ● Job can also be used to run multiple pods in parallel ● A job can be scaled up using the kubectl scale command ● Job’s spec may define the parallelism value for running multiple pods in parallel
  • 11.
    Use case forJobs â—Ź One time, initialization of resources â—‹ Databases â—‹ File Systems â—‹ Cache â—‹ Configuration â—Ź Multiple workers to process messages in a queue
  • 12.
    Demo Using Run toComplete Jobs
  • 13.
    Configuring Cron Jobs â—ŹA Cron Job manages time based Jobs â—‹ Once at a specified point in time â—‹ Repeatedly at a specified point in time â—Ź Each Cron Job is similar to one line of a crontab (cron table) file â—Ź A typical use cases include â—‹ Schedule a job execution at a given point in time. â—‹ Create a periodic job â–  Database backup â–  Sending emails Works only on clusters with --runtime-config=batch/v2alpha1=true
  • 14.
  • 15.
    Upcoming Webinar Tips andTricks of Using Kubectl, the Kubernetes CLI 9AM PST, Thursday, June 29th Kubectl the command line tool for accessing the Kubernetes cluster. Written in Go language, this nifty tool offers powerful functionality. This webinar will show you how to turn Kubectl into a swiss army knife for performing a variety of functions. We will uncover the hidden gems of the Kubernetes CLI. Register at kube.live for the upcoming webinars â—Ź Unleashing the power of Kubectl â—Ź Kubectl tips & tricks â—Ź Hidden gems of Kubernetes CLI
  • 16.
    Thank You! Send yourFeedback / Questions / Comments jani@janakiram.com