liveBook · Manning

Noschedule

As explained in Kubernetes for Developers

NoSchedule is a Kubernetes taint effect that prevents new Pods lacking a matching toleration from being scheduled on a node.

NoSchedule is a Kubernetes taint effect that prevents new Pods from being scheduled on a tainted node unless their PodSpec includes a matching toleration. It suits special or lower-availability nodes that ordinary workloads should avoid by default. section 8.1.3

Use NoSchedule to:

  • Reserve Spot or other special nodes for workloads that explicitly tolerate their taint. section 8.1.3
  • Prefer a firm scheduling boundary over PreferNoSchedule, which creates only a soft rule and can complicate diagnosis. section 8.1.3
  • Apply taints to node groups in hosted Kubernetes platforms so replacement nodes retain the policy. section 8.1.3

Tainting a Spot node

Run `kubectl taint nodes $NODE_NAME spot=true:NoSchedule`, then add a `spot=true` toleration to workloads allowed on that node. A workload without the toleration remains unscheduled there. section 8.1.3

$ minikube start --nodes 3
Done! kubectl is now configured to use "minikube" cluster

$ kubectl get nodes
NAME           STATUS     ROLES           AGE   VERSION
minikube       Ready      control-plane   77s   v1.24.3
minikube-m02   Ready      <none>          55s   v1.24.3
minikube-m03   NotReady   <none>          19s   v1.24.3

$ NODE_NAME=minikube-m02
$ kubectl taint nodes $NODE_NAME spot=true:NoSchedule
node/minikube-m02 tainted

Inspect a Minikube cluster, identify a node, and apply a spot=true:NoSchedule taint. section 8.1.3

How Kubernetes for Developers covers it

How deep it goes
Explains taints, matching tolerations, soft-rule tradeoffs, and node-group persistence, but does not detail scheduler internals.
Examples
Uses Minikube Spot-node commands, a tolerant Deployment, and GPU and DaemonSet scheduling configurations.
What it assumes
Assumes familiarity with Pods and node scheduling while introducing taints and tolerations through a concrete Minikube experiment.
What you can do after
Apply it via kubectl or node-pool configuration and configure permitted Pods with matching tolerations.
How it connects
Connects taints with tolerations, node selectors, node affinity, DaemonSets, Spot compute, and GPU workloads.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes for Developers. The section links point to the parts of the book it draws on.