Skip to content
CKAWorkloads & SchedulingTwo nodesEasy

Required node affinity

Scenario cka-wkl-005 · about 6 minutes · 5 points · 6 grader checks

Pin a Pod to nodes with a given label using required node affinity rather than a nodeSelector.

  • node-affinity
  • scheduling
  • labels
  • workloads

What you will practise

  • Author requiredDuringSchedulingIgnoredDuringExecution node affinity
  • Use matchExpressions with the In operator
  • Verify placement with kubectl get pod -o wide

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-wkl-005

Task

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

Some nodes are labelled disktype=ssd. In namespace "default", create a Pod named "pinned" using image nginx:1.27 that uses requiredDuringSchedulingIgnoredDuringExecution node affinity so it can only run on nodes labelled disktype=ssd. Do not use a nodeSelector shortcut. The Pod must be Running.

Requirements and details

Certification
CKA · Certified Kubernetes Administrator
Domain
Workloads & Scheduling
Difficulty
Easy
Cluster topology
Two nodes
Cluster features
None beyond the base cluster
Recommended time
6 minutes
Points
5
Grader checks
6
Kubernetes version
1.37
Minimum CLI version
0.1.0
Scenario version
1
Published

Grading runs locally: 6 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.

CKAWorkloads & SchedulingMedium

Taint, toleration and placement

Taint a worker node and run a Pod that tolerates the taint and is placed on that node.

Two nodes · ~7 min · 6 points

  • taint
  • toleration
  • scheduling
  • nodename

goldenkube start cka-sch-001

CKAWorkloads & SchedulingMedium

Spread replicas across nodes

Create a Deployment whose replicas are guaranteed to land on different nodes.

Three nodes · ~8 min · 6 points

  • scheduling
  • topology-spread
  • pod-anti-affinity
  • deployment

goldenkube start cka-sch-002

CKAWorkloads & SchedulingEasy

Rolling update of a Deployment

Update the image of a running Deployment with a rolling update and confirm all pods run the new image.

Single node · ~4 min · 4 points

  • deployment
  • rolling-update
  • rollout
  • workloads

goldenkube start cka-wkl-002

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