Skip to main content
mastering ckad certified kubernetes application developer

CRDs, StatefulSets, and DaemonSets

2 min read Chapter 67 of 87
Summary

Introduces Custom Resource Definitions as the extension mechanism...

Introduces Custom Resource Definitions as the extension mechanism for the Kubernetes API, StatefulSets for workloads that require stable identity and persistent storage, and DaemonSets for workloads that must run on every node. Establishes the conceptual foundation for the detailed sections that follow.

CRDs, StatefulSets, and DaemonSets

Deployments handle the vast majority of workloads on a Kubernetes cluster. They manage stateless Pods — identical replicas that can be created, destroyed, and replaced in any order without affecting application behavior. But not every workload fits this model.

A database needs stable storage that survives Pod restarts and stable network identities so replicas can find each other. A log collector needs to run on every node in the cluster, not on an arbitrary subset. A certificate authority needs custom API resources to represent certificates, issuers, and signing requests — concepts that don’t exist in the built-in Kubernetes API.

This chapter covers the three workload patterns that address these gaps:

Custom Resource Definitions (CRDs) extend the Kubernetes API itself. They let cluster operators define new resource types — Certificate, VirtualService, PostgresCluster — that behave like native Kubernetes objects. You interact with them through kubectl, they appear in kubectl api-resources, and controllers watch and reconcile them. The CKAD tests awareness of CRDs, not implementation.

StatefulSets manage Pods that need stable, unique identities. Where a Deployment creates Pods with random names (nginx-7d6f8b5c4d-xkm2p), a StatefulSet creates Pods with predictable ordinal names (web-0, web-1, web-2). Each Pod gets its own PersistentVolumeClaim that follows it through rescheduling. Pods are created and deleted in order. These guarantees are essential for databases, distributed caches, and consensus systems.

DaemonSets ensure that a copy of a Pod runs on every node in the cluster (or a selected subset of nodes). When a new node joins, the DaemonSet automatically schedules a Pod on it. When a node is removed, the Pod is cleaned up. This pattern is used for cluster-wide infrastructure: log collectors, monitoring agents, network plugins, and storage drivers.

CKAD Exam Scope

The exam expects you to:

  • Recognize CRDs and interact with custom resources using kubectl (awareness level, not creation)
  • Create and manage StatefulSets with headless Services and volumeClaimTemplates
  • Create and manage DaemonSets, including node selection

The following sections cover each topic in depth, with complete YAML manifests and hands-on exercises.