Apart from running stateless and stateful workloads, Kubernetes can be used to run batch jobs and scheduled jobs. Daemon Sets ensure that each node of the cluster run a specific pod that may provide logging, monitoring, or storage capabilities to applications. This webinar will explore Daemon Sets and Cron Jobs in Kubernetes
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Kubernetes Webinar Series - Exploring Daemon Sets and Jobs
1. Exploring Daemon Sets and Cron
Jobs
Janakiram MSV
Analyst | Advisor | Architect
Janakiram & Associates
Google Developer Expert
@janakiramm
2. 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
4. 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
5. Daemon Set vs Replica Set
Replica Set
Count = 6
P1
P2
P3
P4
P5
P6
Node 1 Node 2 Node 3
Replica Set
6. Daemon Set vs Replica Set
Daemon Set
P1 P2 P3
Node 1 Node 2 Node 3
Daemon Set
7. Daemon Set Use Cases
● Logging Aggregators
● Monitoring
● Load Balancers / Reverse Proxies / API Gateways
● Generic background job that needs to be run on each
node
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 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
11. Use case for Jobs
● One time, initialization of resources
○ Databases
○ File Systems
○ Cache
○ Configuration
● Multiple workers to process messages in a queue
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
15. 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