kubernetes webinar series - exploring daemon sets and jobs

16
Exploring Daemon Sets and Cron Jobs Janakiram MSV Analyst | Advisor | Architect Janakiram & Associates Google Developer Expert @janakiramm

Upload: janakiram-msv

Post on 21-Jan-2018

248 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Kubernetes Webinar Series - Exploring Daemon Sets and Jobs

Exploring Daemon Sets and Cron Jobs

Janakiram MSVAnalyst | Advisor | ArchitectJanakiram & AssociatesGoogle Developer Expert

@janakiramm

Page 2: Kubernetes Webinar Series - Exploring Daemon Sets and Jobs

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

Page 3: Kubernetes Webinar Series - Exploring Daemon Sets and Jobs

Kubernetes Controllers

● Replica Sets● Deployments● Stateful Sets● Daemon Sets● Jobs (One time)● Cron Jobs

Page 4: Kubernetes Webinar Series - Exploring Daemon Sets and 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

Page 5: Kubernetes Webinar Series - Exploring Daemon Sets and Jobs

Daemon Set vs Replica Set

Replica SetCount = 6

P1

P2

P3

P4

P5

P6

Node 1 Node 2 Node 3

Replica Set

Page 6: Kubernetes Webinar Series - Exploring Daemon Sets and Jobs

Daemon Set vs Replica Set

Daemon Set

P1 P2 P3

Node 1 Node 2 Node 3

Daemon Set

Page 7: Kubernetes Webinar Series - Exploring Daemon Sets and Jobs

Daemon Set Use Cases

● Logging Aggregators● Monitoring● Load Balancers / Reverse Proxies / API Gateways● Generic background job that needs to be run on each

node

Page 8: Kubernetes Webinar Series - Exploring Daemon Sets and Jobs

DemoExploring Daemon Set

Page 9: Kubernetes Webinar Series - Exploring Daemon Sets and Jobs

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

Page 10: Kubernetes Webinar Series - Exploring Daemon Sets and Jobs

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

Page 11: Kubernetes Webinar Series - Exploring Daemon Sets and Jobs

Use case for Jobs

● One time, initialization of resources○ Databases○ File Systems○ Cache○ Configuration

● Multiple workers to process messages in a queue

Page 12: Kubernetes Webinar Series - Exploring Daemon Sets and Jobs

DemoUsing Run to Complete Jobs

Page 13: Kubernetes Webinar Series - Exploring Daemon Sets and 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

Page 14: Kubernetes Webinar Series - Exploring Daemon Sets and Jobs

DemoUsing Cron Jobs

Page 15: Kubernetes Webinar Series - Exploring Daemon Sets and Jobs

Upcoming WebinarTips and Tricks of Using Kubectl, the Kubernetes CLI9AM 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

Page 16: Kubernetes Webinar Series - Exploring Daemon Sets and Jobs

Thank You!Send your Feedback / Questions / Comments [email protected]