<p>im practicing with kubernetes taints , i have tainted my node and than make a deploy like this:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
        name: nginx
        labels:
         app: nginx
spec:
        replicas: 3
        selector:
          matchLabels:
               app: nginx
        template:
          metadata:
            labels:
              app: nginx
          spec:
            containers:
            - name: nginx
              image: nginx:1.15.4
              ports:
              - containerPort: 80
            tolerations:
            - key: &quot;test&quot;
              operator: &quot;Equal&quot;
              value: &quot;blue&quot;
              effect: &quot;NoSchedule&quot;
</code></pre>
<p>kubectl describe nodes knode2 :</p>
<pre><code>Name:               knode2
Roles:              &lt;none&gt;
Labels:             beta.kubernetes.io/arch=amd64
                    beta.kubernetes.io/os=linux
                    kubernetes.io/arch=amd64
                    kubernetes.io/hostname=knode2
                    kubernetes.io/os=linux
                    testing=test
Annotations:        kubeadm.alpha.kubernetes.io/cri-socket: /var/run/dockershim.sock
                    node.alpha.kubernetes.io/ttl: 0
                    projectcalico.org/IPv4Address: **********
                    projectcalico.org/IPv4IPIPTunnelAddr: ********
                    volumes.kubernetes.io/controller-managed-attach-detach: true
CreationTimestamp:  Tue, 27 Oct 2020 17:23:47 +0200
Taints:             test=blue:NoSchedule
</code></pre>
<p>but when i deploy this yaml file the pods are not going only to that tainted node.
Why is that?</p>

Yahav
<p>Taints and tolerations work together to ensure that pods are not scheduled onto inappropriate nodes. That's exactly opposite of what you intend to do.</p>
<p>You can constrain a Pod to only be able to run on particular Node(s), or to prefer to run on particular nodes using <a href="https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector" rel="nofollow noreferrer">NodeSelector</a> or <a href="https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity" rel="nofollow noreferrer">NodeAffinity</a>.</p>
<p>NodeSelector example</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: nginx
  labels:
    env: test
spec:
  containers:
  - name: nginx
    image: nginx
    imagePullPolicy: IfNotPresent
  nodeSelector:
    disktype: ssd
</code></pre>
<p>Node affinity is conceptually similar to nodeSelector -- it allows you to constrain which nodes your pod is eligible to be scheduled on, based on labels on the node.</p>
