Schedule Pods Using Taints, Tolerations, and NodeSelector with Host Namespaces
Scenario
node-02 needs to be labeled and tainted for maintenance.
A dedicated Pod must run on it using nodeSelector and a matching toleration, with access to the host network, PID, and IPC namespaces.
Task
1. Label node-02 with role=maintenance.
2. Taint node-02 with key maintenance, value true, effect NoExecute.
3. Create a Pod named node-access in the maintenance namespace with:
- image:
busybox:stable hostNetwork: truehostPID: truehostIPC: truenodeSelectortargetingrole=maintenance- toleration matching the taint on
node-02withoperator: Equal,tolerationSeconds: 3600
4. Verify the Pod is running on node-02, its IP matches the node IP(hostNetwork), and that node-level processes(hostPID) and shared memory segments(hostIPC) are visible from inside the Pod.
Hint
Label the node first: kubectl label node node-02 role=maintenance.
Then taint it: kubectl taint nodes node-02 maintenance=true:NoExecute.
Use nodeSelector with role: maintenance and add a matching tolerations entry with tolerationSeconds: 3600 in the Pod spec.