<p>I want to deploy a simple nginx on my master node.</p>
<p>Basically, if i use the <code>tolerations</code> combined by <code>nodeName</code> everything is good:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: myapp
  name: myapp-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myapp
  template:
    metadata:
      labels:
        app: myapp
    spec:
      containers:
      - image: nginx
        name: myapp-container
      tolerations:
        - effect: NoExecute
          operator: Exists
      nodeName: master
</code></pre>
<p>The results:</p>
<pre class="lang-bash prettyprint-override"><code>NAME                               READY   STATUS    RESTARTS   AGE   IP           NODE     NOMINATED NODE   READINESS GATES
myapp-deployment-56d5887b9-fw5mj   1/1     Running   0          50s   100.32.0.4   master   &lt;none&gt;           &lt;none&gt;
</code></pre>
<p>But the problem is when i add a <code>type=master</code> label to my node and instead of <code>nodeName</code>, useing <code>nodeselector</code>, the deployment stays in <code>Pending</code> state!</p>
<p>Here are my steps:</p>
<ol>
<li>Add label to my node: <code>k label node master type=master</code></li>
<li>Check the node label:</li>
</ol>
<pre class="lang-bash prettyprint-override"><code>$ k get no --show-labels

NAME     STATUS   ROLES           AGE   VERSION   LABELS
master   Ready    control-plane   65d   v1.24.1   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=master,kubernetes.io/os=linux,node-role.kubernetes.io/control-plane=,node.kubernetes.io/exclude-from-external-load-balancers=,type=master
</code></pre>
<ol start="3">
<li>Apply my new yaml file:</li>
</ol>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: myapp
  name: myapp-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myapp
  template:
    metadata:
      labels:
        app: myapp
    spec:
      containers:
      - image: nginx
        name: myapp-container
      tolerations:
        - effect: NoExecute
          operator: Exists
      nodeSelector:
        type: master
</code></pre>
<ol start="4">
<li>Check the state:</li>
</ol>
<pre class="lang-bash prettyprint-override"><code>$ k get po

NAME                                READY   STATUS    RESTARTS   AGE
myapp-deployment-544784ff98-2qf7z   0/1     Pending   0          3s
</code></pre>
<ol start="5">
<li>Describe it:</li>
</ol>
<pre class="lang-bash prettyprint-override"><code>Name:           myapp-deployment-544784ff98-2qf7z
Namespace:      default
Priority:       0
Node:           &lt;none&gt;
Labels:         app=myapp
                pod-template-hash=544784ff98
Annotations:    &lt;none&gt;
Status:         Pending
IP:             
IPs:            &lt;none&gt;
Controlled By:  ReplicaSet/myapp-deployment-544784ff98
Containers:
  myapp-container:
    Image:        nginx
    Port:         &lt;none&gt;
    Host Port:    &lt;none&gt;
    Environment:  &lt;none&gt;
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-lbtsv (ro)
Conditions:
  Type           Status
  PodScheduled   False 
Volumes:
  kube-api-access-lbtsv:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       &lt;nil&gt;
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              type=master
Tolerations:                 :NoExecute op=Exists
Events:
  Type     Reason            Age   From               Message
  ----     ------            ----  ----               -------
  Warning  FailedScheduling  111s  default-scheduler  0/1 nodes are available: 1 node(s) had untolerated taint {node-role.kubernetes.io/master: }. preemption: 0/1 nodes are available: 1 Preemption is not helpful for scheduling.
</code></pre>
<p>Where am i wrong? What is my problem?</p>
<p>P.S: kubernetes version:</p>
<pre class="lang-bash prettyprint-override"><code>Client Version: v1.24.1
Kustomize Version: v4.5.4
Server Version: v1.24.1
</code></pre>

Ali
<p>Check your master node it might be having the <strong>taint</strong> set to <strong>NoSchedule</strong></p>
<pre><code>kubectl describe node &lt;Node name&gt; | grep Taint
</code></pre>
<p>If you want to run POD on master node use this config</p>
<pre><code>tolerations:
  - key: &quot;node-role.kubernetes.io/master&quot;
    operator: &quot;Exists&quot;
    effect: &quot;NoSchedule&quot;
  nodeSelector:
    node-role.kubernetes.io/master: &quot;&quot;
</code></pre>
<p>Read more about the <strong>Concept</strong> taint and toleration: <a href="https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/</a></p>
