Skip to content
CKAStorageTwo nodesMedium

StatefulSet with volumeClaimTemplates

Scenario cka-sto-004 · about 10 minutes · 7 points · 10 grader checks

Create a headless Service and a StatefulSet whose pod gets its own dynamically provisioned PVC.

  • storage
  • statefulset
  • headless
  • volumeclaimtemplate
  • pvc

What you will practise

  • Create a headless governing Service
  • Author a StatefulSet with volumeClaimTemplates
  • Recognise generated PVC naming (<template>-<sts>-<ordinal>)

Start this lab

With the CLI installed and signed in, this command provisions a two nodes cluster on your Mac, applies the scenario setup and prints the task below.

goldenkube start cka-sto-004

Task

The task text exactly as the CLI shows it. Solve it on the cluster, then run goldenkube submit.

In namespace "data" (create it if missing), create a headless Service named "pg" (clusterIP: None, port 80, selector app=pg) and a StatefulSet named "pg" with serviceName "pg", 1 replica, image nginx:1.27, pod label app=pg. The StatefulSet must have a volumeClaimTemplate named "pgdata" requesting 1Gi, accessMode ReadWriteOnce, StorageClass "local-path", mounted in the container at /var/lib/data. The StatefulSet must have 1 ready replica and the generated PVC "pgdata-pg-0" must be Bound.

Requirements and details

Certification
CKA · Certified Kubernetes Administrator
Domain
Storage
Difficulty
Medium
Cluster topology
Two nodes
Cluster features
Storage
Recommended time
10 minutes
Points
7
Grader checks
10
Kubernetes version
1.37
Minimum CLI version
0.1.0
Scenario version
1
Published

Grading runs locally: 10 state checks read your cluster when you submit; the scenario passes when every check passes. Hints, the reference solution and the check definitions are available only inside the CLI, not on this page.

CKAStorageMedium

Manual PersistentVolume and matching claim

Create a hostPath PersistentVolume and a PersistentVolumeClaim that binds to it.

Single node · ~7 min · 6 points

  • storage
  • pv
  • pvc
  • hostpath

goldenkube start cka-sto-002

CKAStorageMedium

Default StorageClass

Make an existing StorageClass the cluster default and provision a PVC without naming a class.

Single node · ~8 min · 6 points · Storage

  • storage
  • storageclass
  • default
  • pvc

goldenkube start cka-sto-003

Independent community project, not affiliated with or endorsed by CNCF or The Linux Foundation. Lab results are practice feedback, not an exam score.