Using DaemonSets in Kubernetes

Get Started
30 minutes
  • 2 Learning Objectives

About this Hands-on Lab

DaemonSets are a great way to ensure a pod replica runs dynamically on each node. They even automatically handle the creation and removal of such pods when nodes join or leave the cluster. In this lab, you will have the opportunity to practice your skills with DaemonSets by using them to run pods on all nodes in an existing cluster.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create a DaemonSet Specification YAML File

Create a file called daemonset.yml with a DaemonSet YAML specification. Use the provided pod specification in the DaemonSet template.

Create the DaemonSet in the Cluster

Use your specification YAML file to create the DaemonSet in the cluster. Verify each worker node is running a copy of your pod and the DaemonSet pods are all running.

Additional Resources

You are working for BeeBox, a company that provides regular shipments of bees to customers.

The company is using some software on their K8s worker nodes that periodically leaves unnecessary data in a particular location on the worker node. Since this software could run on any node at any time, this trash data periodically appears on various worker nodes and should be cleaned up.

Configure the cluster to create a pod on each worker node that periodically deleted the contents of the /etc/beebox/tmp on the worker node. Make sure a copy of this pod is automatically created on each worker node, even as new nodes are added to the cluster. Note that you should not run a copy of the pod on the control plane node.

To accomplish this, you can use the following pod specification as a template:

spec:
  containers:
  - name: busybox
    image: busybox:1.27
    command: ['sh', '-c', 'while true; do rm -rf /beebox-temp/*; sleep 60; done']
    volumeMounts:
    - name: beebox-tmp
      mountPath: /beebox-temp
  volumes:
  - name: beebox-tmp
    hostPath:
      path: /etc/beebox/tmp
What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!
Thanks for reaching out!

You’ll hear from us shortly. In the meantime, why not check out what our customers have to say about ACG?