{"id":15738,"date":"2020-07-05T15:23:20","date_gmt":"2020-07-05T15:23:20","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=15738"},"modified":"2021-10-30T06:54:25","modified_gmt":"2021-10-30T06:54:25","slug":"understanding-kubernetess-taints-and-tolerations-in-easy-way","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/understanding-kubernetess-taints-and-tolerations-in-easy-way\/","title":{"rendered":"Understanding Kubernetes&#8217;s Taints and Tolerations in easy way"},"content":{"rendered":"\n<p><strong>What is meaning of taint?<\/strong><br>a trace of a bad or undesirable substance or quality.<\/p>\n\n\n\n<p><strong>What is tainted?<\/strong><br>spoiled; damaged in quality, taste, or value.<\/p>\n\n\n\n<p><strong>What is toleration?<\/strong><br>the practice of tolerating something, in particular differences of opinion or behaviour.<\/p>\n\n\n\n<p><strong>Here in Kubernetes, we use taint with nodes and Tolerations with Pod.<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Node affinity,<\/strong> is a property of Pods that attracts them to a set of nodes (either as a preference or a hard requirement).<\/li><li><strong>Taints are the opposite<\/strong> &#8212; they allow a node to repel a set of pods.<\/li><li><strong>Tolerations <\/strong>&#8211; Tolerations are applied to pods, and allow (but do not require) the pods to schedule onto nodes with matching taints.<\/li><\/ul>\n\n\n\n<p><strong>Taints and tolerations work together <\/strong>to ensure that pods are not scheduled onto inappropriate nodes. One or more taints are applied to a node; this marks that the node should not accept any pods that do not tolerate the taints.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"765\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/07\/kubernetes-Taints-Tolerations-example-1024x765.png\" alt=\"\" class=\"wp-image-15741\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/07\/kubernetes-Taints-Tolerations-example-1024x765.png 1024w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/07\/kubernetes-Taints-Tolerations-example-300x224.png 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/07\/kubernetes-Taints-Tolerations-example-768x574.png 768w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/07\/kubernetes-Taints-Tolerations-example.png 1288w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>Lets understand using taint with one or more nodes in Kubernetes first.<\/strong><br><\/p>\n\n\n\n<figure class=\"wp-block-embed-wordpress wp-block-embed is-type-wp-embed is-provider-devopsschool-com\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"4dVLcovOeg\"><a href=\"https:\/\/www.devopsschool.com\/blog\/deep-dive-into-kubernetes-taint-with-node\/\">Update the taints on one or more nodes in Kubernetes<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Update the taints on one or more nodes in Kubernetes&#8221; &#8212; DevOpsSchool.com\" src=\"https:\/\/www.devopsschool.com\/blog\/deep-dive-into-kubernetes-taint-with-node\/embed\/#?secret=4dVLcovOeg\" data-secret=\"4dVLcovOeg\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p><strong>The default value for operator is Equal.<\/strong><\/p>\n\n\n\n<p>A toleration &#8220;matches&#8221; a taint if the keys are the same and the effects are the same, and:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>the operator is Exists (in which case no value should be specified), or<\/li><li>the operator is Equal and the values are equal.<\/li><\/ul>\n\n\n\n<p><strong>Here\u2019s an example of a pod that uses tolerations:<\/strong><\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/devops-school\/591efb454773acd00fa75ae4466ae42a.js\"><\/script>\n\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_78893\"><iframe loading=\"lazy\"  id=\"_ytid_46853\"  width=\"760\" height=\"427\"  data-origwidth=\"760\" data-origheight=\"427\" src=\"https:\/\/www.youtube.com\/embed\/?enablejsapi=1&#038;autoplay=0&#038;cc_load_policy=0&#038;cc_lang_pref=&#038;iv_load_policy=1&#038;loop=0&#038;rel=1&#038;fs=1&#038;playsinline=0&#038;autohide=2&#038;theme=dark&#038;color=red&#038;controls=1&#038;disablekb=0&#038;\" class=\"__youtube_prefs__  no-lazyload\" title=\"YouTube player\"  data-epytgalleryid=\"epyt_gallery_78893\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe><div class=\"epyt-gallery-list\"><div>Sorry, there was a YouTube error.<\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>What is meaning of taint?a trace of a bad or undesirable substance or quality. What is tainted?spoiled; damaged in quality, taste, or value. What is toleration?the practice of tolerating something,&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[1],"tags":[],"class_list":["post-15738","post","type-post","status-publish","format-standard","hentry","category-sql"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/15738","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=15738"}],"version-history":[{"count":3,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/15738\/revisions"}],"predecessor-version":[{"id":24687,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/15738\/revisions\/24687"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=15738"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=15738"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=15738"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}