Scheduling a pod to a particular node using node-affinity #
This image shows you what you should expect when testing this scenario. You can follow the step-by-step guide after seeing this.
Prerequisites #
- KWOK must be installed on the machine. See installation.
- Install kubectl
Create cluster #
kwokctl create cluster
View clusters #
- This ensures that the cluster was created successfully.
kwokctl get clusters
Create nodes #
kwokctl scale node --replicas 2
Label node-000000
kubectl label node node-000000 region=us-west-2
Scheduling process #
Step 1: Deploy pod #
The pod has a node affinity configured with a key value of region=eu-west-2
. This matches the label on node-000000.
kubectl apply -f pod.yaml
Step 2: View the node the pod is scheduled to. #
kubectl get pod -o wide
- Pod 1 is scheduled to node-000000.
Delete the cluster #
kwokctl delete cluster
Conclusion #
This example demonstrates how to use KWOK to simulate a scheduling scenario based on node affinity policy.