The PersistentVolume "postgres-pv-volume" is invalid:
* spec.persistentvolumesource: Forbidden: is immutable after creation
* nodeAffinity: Invalid value: "null": field is immutable
It looks like for some reason nodeAffinity:
field is required in spec:
section of your PersistentVolume
definition and it is automatically added by the generator and assigned with the value of null
. Value of this field is immutable i.e. cannot be changed once created. You can check what is the exact output by creating only yaml manifest of your PV
resource. You can do it by adding --dry-run -o yaml
options.
Do you have any NFS server
behind DNS
name storage-server
available in the default namespace of your k8s cluster ? We need more info about your environment setup to be able to help you. Do you use on-premise k8s cluster or any cloud solution ? As you can read here (docs for v1.16) (but it looks exactly the same in v1.14 that you're using):
Note: For most volume types, you do not need to set this field. It is
automatically populated for AWS EBS, GCE PD and Azure Disk volume
block types. You need to explicitly set this for local volumes.
A PV can specify node affinity to define constraints that limit what
nodes this volume can be accessed from. Pods that use a PV will only
be scheduled to nodes that are selected by the node affinity.
As to your comment:
In another namespace, I got very similar NFS volume, also without the
nfs-server service, but created in Kubernetes 1.11. Why it still
works? Something changed with the requirements? – Djent 1 hour ago
You need to describe it more precisely so it can be compared but keep in mind that 1.11 is at the moment obsolete version which is not supported any more and I'm pretty sure there could've been some considerable changes introduced since that time. It's even impossible to check it on kubernetes.io website as it is not maintained any more (the oldest maintained version of k8s documentation is currently 1.12). If such configuration works for you on 1.11 cluster it probably means that it works quite differently in 1.14 if you're not able to implement it the same way.