Merge pull request #27884 from jingxu97/nodename

Update note for waitForFirstConsumer binding mode with example
This commit is contained in:
Kubernetes Prow Robot 2021-05-11 16:03:38 -07:00 committed by GitHub
commit 45f36649ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 32 additions and 2 deletions

View File

@ -154,9 +154,9 @@ the class or PV. If a mount option is invalid, the PV mount fails.
### Volume Binding Mode ### Volume Binding Mode
The `volumeBindingMode` field controls when [volume binding and dynamic The `volumeBindingMode` field controls when [volume binding and dynamic
provisioning](/docs/concepts/storage/persistent-volumes/#provisioning) should occur. provisioning](/docs/concepts/storage/persistent-volumes/#provisioning) should occur. When unset, "Immediate" mode is used by default.
By default, the `Immediate` mode indicates that volume binding and dynamic The `Immediate` mode indicates that volume binding and dynamic
provisioning occurs once the PersistentVolumeClaim is created. For storage provisioning occurs once the PersistentVolumeClaim is created. For storage
backends that are topology-constrained and not globally accessible from all Nodes backends that are topology-constrained and not globally accessible from all Nodes
in the cluster, PersistentVolumes will be bound or provisioned without knowledge of the Pod's scheduling in the cluster, PersistentVolumes will be bound or provisioned without knowledge of the Pod's scheduling
@ -188,6 +188,36 @@ The following plugins support `WaitForFirstConsumer` with pre-created Persistent
and pre-created PVs, but you'll need to look at the documentation for a specific CSI driver and pre-created PVs, but you'll need to look at the documentation for a specific CSI driver
to see its supported topology keys and examples. to see its supported topology keys and examples.
{{< note >}}
If you choose to use `waitForFirstConsumer`, do not use `nodeName` in the Pod spec
to specify node affinity. If `nodeName` is used in this case, the scheduler will be bypassed and PVC will remain in `pending` state.
Instead, you can use node selector for hostname in this case as shown below.
{{< /note >}}
```yaml
apiVersion: v1
kind: Pod
metadata:
name: task-pv-pod
spec:
nodeSelector:
kubernetes.io/hostname: kube-01
volumes:
- name: task-pv-storage
persistentVolumeClaim:
claimName: task-pv-claim
containers:
- name: task-pv-container
image: nginx
ports:
- containerPort: 80
name: "http-server"
volumeMounts:
- mountPath: "/usr/share/nginx/html"
name: task-pv-storage
```
### Allowed Topologies ### Allowed Topologies
When a cluster operator specifies the `WaitForFirstConsumer` volume binding mode, it is no longer necessary When a cluster operator specifies the `WaitForFirstConsumer` volume binding mode, it is no longer necessary