{"id":1229,"date":"2021-01-12T08:57:23","date_gmt":"2021-01-12T08:57:23","guid":{"rendered":"https:\/\/blog.samarthya.me\/wps\/?p=1229"},"modified":"2021-01-12T08:57:46","modified_gmt":"2021-01-12T08:57:46","slug":"taint-nodes","status":"publish","type":"post","link":"https:\/\/blog.samarthya.me\/wps\/2021\/01\/12\/taint-nodes\/","title":{"rendered":"Taint Nodes"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Reference<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/kubernetes.io\/docs\/concepts\/scheduling-eviction\/taint-and-toleration\/\">https:\/\/kubernetes.io\/docs\/concepts\/scheduling-eviction\/taint-and-toleration\/<\/a><\/li><li><a href=\"https:\/\/kubernetes.io\/docs\/concepts\/scheduling-eviction\/taint-and-toleration\/#example-use-cases\">https:\/\/kubernetes.io\/docs\/concepts\/scheduling-eviction\/taint-and-toleration\/#example-use-cases<\/a><\/li><\/ul>\n\n\n\n<p>Before we understand the tainting we should know about the Node Affinity. It the by the virtue of Affinity that pods attracts nodes as a preference or as a basic requirement.<\/p>\n\n\n\n<p>Tainting is the exact opposite &#8211; To repel a node from scheduling a pod.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>taint node ip-10-0-1-103 node-type=prod:NoSchedule<\/code><\/pre>\n\n\n\n<p>In the case above a taint is placed for Node identified by <code>ip-10-0-1-103<\/code>. The taint has a key value and effect as evident in above example.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>node-type<\/code><\/li><li><code>prod<\/code><\/li><li><code>NoSchedule<\/code><\/li><\/ul>\n\n\n\n<p>You can specify toleration for the pod as in the example below<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: apps\/v1\nkind: Deployment\nmetadata:\n  name: my-prod\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: my-prod\n  template:\n    metadata:\n      labels:\n        app: my-prod\n    spec:\n      containers:\n      - args:\n        - sleep\n        - \"3600\"\n        image: busybox\n        name: main\n      tolerations:\n      - key: node-type\n        operator: Equal\n        value: prod\n        effect: NoSchedule                    <\/code><\/pre>\n\n\n\n<p>The operator can be <code>exists<\/code> or <code>equal<\/code> for the mentioned example<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Environment<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">K GET NODES<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>NAME            STATUS   ROLES    AGE   VERSION\nip-10-0-1-101   Ready    master   38m   v1.13.3\nip-10-0-1-102   Ready    &lt;none&gt;   38m   v1.13.3\nip-10-0-1-103   Ready    &lt;none&gt;   38m   v1.13.3<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Reference https:\/\/kubernetes.io\/docs\/concepts\/scheduling-eviction\/taint-and-toleration\/ https:\/\/kubernetes.io\/docs\/concepts\/scheduling-eviction\/taint-and-toleration\/#example-use-cases Before we understand the tainting we should know about the Node Affinity. It the by the virtue of Affinity that pods attracts nodes as a preference or as a basic requirement. Tainting is the exact opposite &#8211; To repel a node from scheduling a pod. In the case above a taint is [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":1231,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"image","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[86,34],"tags":[18,136],"class_list":["post-1229","post","type-post","status-publish","format-image","has-post-thumbnail","hentry","category-docker","category-technical","tag-k8s","tag-taint","post_format-post-format-image"],"_links":{"self":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts\/1229","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/comments?post=1229"}],"version-history":[{"count":0,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts\/1229\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/media\/1231"}],"wp:attachment":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/media?parent=1229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/categories?post=1229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/tags?post=1229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}