Skip to content

Instantly share code, notes, and snippets.

@swagfin
Created February 27, 2026 23:38
Show Gist options
  • Select an option

  • Save swagfin/fe14d3cfa10c6cf3fff67adddef9feaa to your computer and use it in GitHub Desktop.

Select an option

Save swagfin/fe14d3cfa10c6cf3fff67adddef9feaa to your computer and use it in GitHub Desktop.
MicroK8s - Control Plane Scheduling Management

MicroK8s - Control Plane Scheduling Management


πŸ”’ 1. Make Control Plane Node Unschedulable (Application Pods)

Prevent normal workloads from being scheduled on the control-plane node:

microk8s kubectl taint nodes {{ your-control-pane-node }} node-role.kubernetes.io/control-plane=:NoSchedule

What this does: - Blocks new pods from being scheduled there - Does NOT affect system pods - Does NOT remove existing pods


🚚 2. Evict Existing Workloads from Control Plane

If application pods are already running on the control-plane node and you want to move them:

microk8s kubectl drain {{ your-control-pane-node }} --ignore-daemonsets --delete-emptydir-data

Options explained:

  • --ignore-daemonsets β†’ keeps DaemonSet pods (like ingress)
  • --delete-emptydir-data β†’ removes ephemeral storage data
  • Pods will be rescheduled onto worker nodes (if replicas exist)

⚠️ Important: drain automatically cordons the node (marks it as unschedulable).
This prevents ANY new pods from being scheduled --- even those with tolerations.


πŸ”“ 3. Re-Enable Scheduling on the Control Plane (Required After Drain)

After draining, if you still want specific pods to run there, you MUST uncordon the node:

microk8s kubectl uncordon {{ your-control-pane-node }}

Without this step, you may see errors like:

0/10 nodes are available: 1 node(s) were unschedulable

This error usually means the node is still cordoned.


πŸ”“ 4. Allow Specific Pods to Still Run on Control Plane

If certain workloads must run on the control-plane node
(e.g., hostPath storage or special system workloads),

Add both:

  • nodeAffinity (forces pod onto that node)
  • toleration (allows pod to bypass the taint)

Example:

spec:
  # Allow pod to be scheduled even if node has NoSchedule taint
  tolerations:
  - key: "node-role.kubernetes.io/control-plane"
    operator: "Exists"
    effect: "NoSchedule"

Undoing | Make Control Plane Fully Schedulable Again

πŸ” 1. Wish to Remove the Taint ?? (Make Control Plane Fully Schedulable Again)

If you want the control-plane node to behave like a normal worker again:

microk8s kubectl taint nodes {{ your-control-pane-node }} node-role.kubernetes.io/control-plane:NoSchedule-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment