Kubernetes -Taint, Toleration and its Applications
In this article I am sharing about Kubernetes Taint, Toleration and its applications in AI using GPU, StatefulSets, etc. using EKS.
Series: AWS Platform Engineering (6 articles)
- 2Kubernetes -Taint, Toleration and its Applications This article
In this article I am sharing about Kubernetes Taint, Toleration and its application in our implementation using EKS. This property is called Node Affinity. This feature is relevant for current AI applications as well to ensure we do not schedule basic applications in GPU nodes. They are reserved for specific AI applications alone. Recipe: Prevent pods from being scheduled on specific nodes - Amazon EKS
Application Use case
In an Application, StatefulSet is used for applications which maintains the state of the application. Deployments are used for AI applications where state is not required to be maintained.
In our implementation, we had a StatefulSet and multiple deployments for the application. StatefulSet specific pods required high compute capacity in our application. It did not work properly if other deployments are scheduled in same node as the stateful set pods. Hence, we used taint and toleration to schedule the StatefulSet pods in specific nodes only and ensure other deployments are not scheduled in that node. This entire application was implemented in same namespace.
This featured is also used in Kubernetes architecture to ensure pods of client application is not scheduled in master node/control node of EKS Cluster/Kubernetes cluster.
What is Taint and Toleration?
In Kubernetes, it is a feature to ensure we can schedule the pods in specific nodes of Kubernetes Cluster. Taints and Tolerations | Kubernetes
Taint
Taint is applied on nodes. In below example node1 is tainted to ensure if there is no toleration with specific key - value pair (key1, value1) then NoSchedule (It means cannot be scheduled).
Toleration
Toleration is applied pods. It allows it to be scheduled in specific tainted nodes only.
Sample Toleration in pod:
1
2
3
4
5
6
7
8
9
10
11
12
13
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
containers:
- name: nginx
image: nginx
tolerations:
- key: "key1"
operator: "Equal"
value: "value1"
effect: "NoSchedule"Sample Taint in node:
1
kubectl taint nodes node1 key1=value1:NoSchedule
Series: AWS Platform Engineering (6 articles)
- 2Kubernetes -Taint, Toleration and its Applications This article
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article