# Local persistent volume - unable to configure Node Affinity

**URL:** <https://forums.suse.com/t/local-persistent-volume-unable-to-configure-node-affinity/15457>\
**Category:** SUSE Rancher Prime\
**Created:** [October 6, 2019, 7:46pm UTC](https://forums.suse.com/t/local-persistent-volume-unable-to-configure-node-affinity/15457 "2019-10-06T19:46:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rdolezel](https://avatars.discourse-cdn.com/v4/letter/r/7bcc69/32.png) [@rdolezel](https://forums.suse.com/u/rdolezel)\
**Post date:** [October 6, 2019, 7:46pm UTC](https://forums.suse.com/t/local-persistent-volume-unable-to-configure-node-affinity/15457/1 "2019-10-06T19:46:44Z")

</div>

I want to add the following rule to my Node Selector via Rancher GUI:  
Key: [kubernetes.io/hostname](http://kubernetes.io/hostname)  
Operator: in list  
Values: my-node-1

When clicking on Save I am receiving the following error:  
Validation failed in API: PersistentVolume “my-volume” is invalid: nodeAffinity: Invalid value: core.VolumeNodeAffinity{Required:(\*core.NodeSelector)(0xc007efbc80)}: field is immutable

I am able to save the following rule in the same Node Selector:  
Key: hostname  
Operator: in list  
Values: my-node-1

Of course my pod is not coming online because of this event:  
Warning  
FailedScheduling  
0/2 nodes are available: 1 node(s) didn’t match node selector, 1 node(s) had volume node affinity conflict.

When I add custom label named Hostname to my-node-1 everything works as expected.

What am I doing wrong?

Edit:  
I was able to create correct PV via kubectl.

```
cat > test-ssd-volume.yaml << EOF
apiVersion: v1
kind: PersistentVolume
metadata:
  name: test-ssd-volume
spec:
  capacity:
    storage: 2Gi
  accessModes:
  - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  volumeMode: Filesystem
  storageClassName: local-ssd
  local:
    path: /mnt/local-storage/ssd/disk1
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: In
          values:
          - my-node-1
EOF

```

> kubectl create -f test-ssd-volume.yaml

Created PV looks fine in Rancher GUI.
