Your DevOps study space

Real explanations. Videos with tests. Fresh exams every time. Keep the streak alive and watch the XP stack up.

Helm, Jobs, CronJobs & DaemonSets · Kubernetes Docs · StackwisePlanDevOps Helm, Jobs, CronJobs & DaemonSets · Kubernetes Docs · StackwiseCodePython Helm, Jobs, CronJobs & DaemonSets · Kubernetes Docs · StackwiseBuildDocker Helm, Jobs, CronJobs & DaemonSets · Kubernetes Docs · StackwiseTestDevOps Helm, Jobs, CronJobs & DaemonSets · Kubernetes Docs · StackwiseReleaseGit Helm, Jobs, CronJobs & DaemonSets · Kubernetes Docs · StackwiseDeployKubernetes Helm, Jobs, CronJobs & DaemonSets · Kubernetes Docs · StackwiseOperateLinux Helm, Jobs, CronJobs & DaemonSets · Kubernetes Docs · StackwiseMonitorDevOps

Pick a topic

Eight tracks, each with docs, a cheat sheet, videos and tests.

How it works

One loop, repeated until it sticks.

Jump back in

Picked up from where you left off.

Free forever

Your DevOps journey starts with one click.

Sign in with Google or GitHub to open every chapter, video, test and challenge. Your progress is saved wherever you learn.

Helm, Jobs, CronJobs & DaemonSets

Deployments are for apps that run forever. Real clusters also run one-off tasks, tasks on a timetable, and agents that must sit on every node, and most third-party software (monitoring, ingress controllers, databases) is installed with Helm rather than hand-written YAML. This chapter covers all four.

Jobs: run to completion

A Job runs a pod until it finishes successfully, retrying if it fails. Database migrations, a one-time data import or a report are typical Jobs.

apiVersion: batch/v1
kind: Job
metadata:
  name: migrate-db
spec:
  backoffLimit: 3                  # retry a failed pod at most 3 times
  activeDeadlineSeconds: 600       # give up after 10 minutes in total
  ttlSecondsAfterFinished: 3600    # delete the finished Job an hour later
  template:
    spec:
      restartPolicy: Never         # Jobs need Never or OnFailure
      containers:
        - name: migrate
          image: ghcr.io/you/myapp:1.4.0
          command: ["python", "manage.py", "migrate"]
$ kubectl apply -f job.yaml
$ kubectl get jobs
NAME         STATUS     COMPLETIONS   DURATION   AGE
migrate-db   Complete   1/1           12s        40s
$ kubectl logs job/migrate-db

CronJobs: Jobs on a timetable

A CronJob creates a Job on a schedule, written in the same five-field format as Linux cron (Linux chapter 9).

apiVersion: batch/v1
kind: CronJob
metadata:
  name: nightly-backup
spec:
  schedule: "0 2 * * *"            # 02:00 every day
  timeZone: "Europe/London"        # without it, the schedule uses the cluster's time zone (usually UTC)
  concurrencyPolicy: Forbid        # don't start a new run while the last one is still going
  successfulJobsHistoryLimit: 3
  failedJobsHistoryLimit: 3
  jobTemplate:
    spec:
      backoffLimit: 2
      template:
        spec:
          restartPolicy: OnFailure
          containers:
            - name: backup
              image: ghcr.io/you/backup:1.0
              args: ["--target", "s3://my-backups"]

Waiting until 2 a.m. to see whether it works is no fun, so trigger a run by hand:

$ kubectl create job backup-test --from=cronjob/nightly-backup
$ kubectl get cronjob nightly-backup     # LAST SCHEDULE shows when it last fired

Set suspend: true in the spec to pause a CronJob without deleting it.

DaemonSets: one pod on every node

A DaemonSet runs exactly one copy of a pod on every node (or every node matching a selector), and adds one automatically when a node joins. It's how clusters run node-level agents: log collectors like Fluent Bit, the Prometheus node exporter, and networking plugins.

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: node-exporter
  namespace: monitoring
spec:
  selector:
    matchLabels: {app: node-exporter}
  template:
    metadata:
      labels: {app: node-exporter}
    spec:
      tolerations:                         # also run on control-plane nodes
        - key: node-role.kubernetes.io/control-plane
          effect: NoSchedule
      containers:
        - name: node-exporter
          image: prom/node-exporter:v1.8.2
          ports:
            - containerPort: 9100

Which workload for which job

runs forever?one per node?on a schedule?yesno, it finishesDaemonSetown storage?yesnoCronJobJobyesnoStatefulSetDeploymentyesno
Two questions settle most cases: does it run forever, and does each copy need something of its own (a node, a disk, a schedule)?
  • Deployment: stateless apps that run forever and can be copied freely (web servers, APIs).
  • StatefulSet: apps where each copy needs its own identity and storage (databases, queues).
  • DaemonSet: one per node (agents and collectors).
  • Job: run once until done.
  • CronJob: run on a schedule.

Helm: a package manager for Kubernetes

Installing something like a full monitoring stack by hand means dozens of YAML files. Helm packages them as a chart: templates plus a values.yaml file of settings you can override. Installing a chart creates a release, which Helm can upgrade, list and roll back as one unit.

# install Helm (on a Mac: brew install helm)
$ curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash

$ helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
$ helm repo update
$ helm search repo prometheus-community
$ helm show values prometheus-community/kube-prometheus-stack > defaults.yaml   # every setting you can change

$ helm install monitoring prometheus-community/kube-prometheus-stack \
    --namespace monitoring --create-namespace -f my-values.yaml

$ helm list -A                         # releases in every namespace
$ helm upgrade monitoring prometheus-community/kube-prometheus-stack -n monitoring -f my-values.yaml
$ helm history monitoring -n monitoring
$ helm rollback monitoring 1 -n monitoring
$ helm uninstall monitoring -n monitoring

Values: changing a chart's settings

You never edit a chart's templates; you override its values, either in a file (best, because it goes in Git) or with --set for a one-off:

# my-values.yaml
grafana:
  adminPassword: change-me
  persistence:
    enabled: true
alertmanager:
  enabled: false
$ helm template monitoring prometheus-community/kube-prometheus-stack -f my-values.yaml | less   # see the YAML without installing
$ helm upgrade --install myapp ./chart -n prod --set image.tag=1.4.0                              # install or upgrade: safe to rerun

helm upgrade --install is what CI pipelines use: it works whether or not the release already exists.

Your own chart

$ helm create myapp       # makes Chart.yaml, values.yaml and templates/
$ helm lint myapp
$ helm install myapp ./myapp -n shop

Inside templates/, values are filled in with Go templating, for example image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}". Start by changing values.yaml and reading what each template does with it.

Common problems

  • cannot re-use a name that is still in use: a release with that name exists. Use helm upgrade --install, or pick another name.
  • A Job retries forever, or never: check backoffLimit and restartPolicy; kubectl describe job shows each attempt.
  • A CronJob never fires: check suspend, the time zone, and the schedule (crontab.guru explains any expression). If a run is missed by more than startingDeadlineSeconds, it's skipped.
  • A DaemonSet has fewer pods than nodes: some nodes have taints the pods don't tolerate, or a nodeSelector excludes them.

Questions

Pick an answer. Get it wrong and you can try again right away, no waiting. 10 questions per topic - pick a filter below, then use Recreate questions for a fresh set on that topic.

Fresh questions every time

Exam

A mixed test across the whole site, shuffled so you never know which topic comes next. When you submit, every mistake comes with the reason and a jump to the exact moment in the video that explains it.

30 questions 6 topics 20 minute limit Up to 70 XP
1–4 answer · ←→ move
History

Essay

0 / 200-250 words
Sample answer
History
0:00 / 0:00
Not started

on YouTube
Subscribe

Topic progress

Activity

Achievements

Settings

Your profile and your account.

Profile details

* Required. Saved in this browser until you sign in.

Letters, numbers, dots, dashes and underscores.
0 / 160

Account

Checking…

App

Install Stackwise on your phone or computer. It opens in its own window from your home screen, and the Docs and cheat sheets you've opened keep working without internet.

Only admins can see this

Dashboard

Sign-ups, activity, messages and reviews in one place.

Prove it

Certificates

Pass a topic's test and get a certificate with its own public page you can share or add to LinkedIn. Each test is 10 questions drawn at random and graded on the server; you need 8 right, you have 15 minutes, and you get one try per topic a day.

From first command to production

Linux for DevOps

A path through Linux the way DevOps engineers use it: ten stages, every command explained with its flags, examples, real output and mistakes, the combinations engineers chain together, and incidents worked through step by step. Practise everything in a safe lab folder.

Before the interview

Interview prep

Questions that come up in real DevOps interviews, with the kind of answer that lands. Say yours out loud first, then compare. Each one links to the chapter that goes deeper.

    Private to you

    My notes

    Everything you wrote down while watching and reading, in one place. Saved to your account, never shown to anyone.