How to Drain A Kubernetes Node Using API

Problem

How to drain a node using k8s API?

Environment

  • Platform9 Managed Kubernetes - v5.3 and Higher

Procedure

There is no single API call to perform node drain. However, you could drain the pods using the Eviction API but you have to write a custom script to run this for all pods running on the node.

Additional Information

Refer: https://kubernetes.io/docs/concepts/scheduling-eviction/api-eviction/ and https://pwittrock.github.io/docs/tasks/administer-cluster/safely-drain-node/#the-eviction-api

Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard