<p>I'm following this <a href="https://phoenixnap.com/kb/how-to-install-jenkins-kubernetes" rel="nofollow noreferrer">Link</a> to setup Jenkins on Kubernetes cluster.</p>
<p>The environment information is mentioned below,</p>
<pre><code>Environment:-

On-Premise Physical Server

# kubectl get nodes
NAME          STATUS   ROLES      AGE     VERSION
master-server Ready    master     2d23h   v1.19.16
node-server1  Ready    worker1    2d23h   v1.19.16
node-server2  Ready    worker2    2d23h   v1.19.16
node-server3  Ready    worker3    2d23h   v1.19.16
</code></pre>
<p>I have below <code>yaml</code> files.</p>
<pre><code>deploy-jenkins.yaml  
sa-jenkins.yaml  
service-jenkins.yaml  
volume-jenkins.yaml
</code></pre>
<p><code>PersistentVolume</code> i want to use my <code>master</code> server local path, So in the <code>volume-jenkins.yaml</code> file I have updated <code>path</code> and <code>values</code> as below.</p>
<pre class="lang-yaml prettyprint-override"><code>  local:
    path: /home/linux-user/kubernetes/jenkins
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: In
          values:
          - master-server
</code></pre>
<p>When i apply the <code>yaml</code> files, My jenkins pod remain in <code>pending</code> status always.</p>
<p>Jenkins Pod status:-</p>
<pre><code># kubectl get pods -n jenkins
NAME                       READY   STATUS    RESTARTS   AGE
jenkins-69b8564b9f-gm48n   0/1     Pending   0          102m
</code></pre>
<p>Jenkins Pod describe Status:-</p>
<pre><code># kubectl describe pod jenkins-69b8564b9f-gm48n -n jenkins

Events:
  Type     Reason            Age                    From               Message
  ----     ------            ----                   ----               -------
  Warning  FailedScheduling  3m45s (x68 over 104m)  default-scheduler  0/4 nodes are available: 1 node(s) had taint {node-role.kubernetes.io/master: }, that the pod didn't tolerate, 3 node(s) had volume node affinity conflict.
</code></pre>
<p>PV describe details:-</p>
<pre><code># kubectl describe pv jenkins-pv -n jenkins

Name:              jenkins-pv
Labels:            type=local
Annotations:       &lt;none&gt;
Finalizers:        [kubernetes.io/pv-protection]
StorageClass:      local-storage
Status:            Bound
Claim:             jenkins/jenkins-pvc
Reclaim Policy:    Retain
Access Modes:      RWO
VolumeMode:        Filesystem
Capacity:          10Gi
Node Affinity:
  Required Terms:
    Term 0:        kubernetes.io/hostname in [master-server]
Message:
Source:
    Type:  LocalVolume (a persistent volume backed by local storage on a node)
    Path:  /home/linux-user/kubernetes/jenkins
Events:    &lt;none&gt;
</code></pre>
<p>What is wrong with my <code>yaml</code> files? and let me know the way to solve the node conflict issue. Thanks in advance.</p>

user4948798
<p><code>...i want to use my master server local path</code></p>
<p>Add <code>nodeSelector</code> and <code>tolerations</code> to your deployment spec:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
...
spec:
  ...
  template:
    ...
    spec:
      nodeSelector:
        node-role.kubernetes.io/master: &quot;&quot;
      tolerations:
      - key: node-role.kubernetes.io/master
        operator: Exists
      containers:
      - name: jenkins
        ...
  
</code></pre>
