Skip to content

Commit 3ea2657

Browse files
authored
Merge pull request #95620 from lpettyjo/enterprise-4.15
[Enterprise-4.15] OCPBUGS-55260#Add static provisioning content for Azure File
2 parents d2766c1 + 973790b commit 3ea2657

File tree

2 files changed

+126
-0
lines changed

2 files changed

+126
-0
lines changed
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * storage/container_storage_interface/persistent_storage-csi-azure-file.adoc
4+
//
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="persistent-storage-csi-azure-file-static-provisioning-procedure_{context}"]
7+
= Static provisioning for Azure File
8+
9+
For static provisioning, cluster administrators create persistent volumes (PVs) that define the details of the real storage. Cluster users can then create persistent volume claims (PVCs) that consume these PVs.
10+
11+
.Prerequisites
12+
* Access to an {product-title} cluster with administrator rights
13+
14+
.Procedure
15+
To use static provisioning for Azure File:
16+
17+
. If you have not yet created a secret for the Azure storage account, create it now:
18+
+
19+
This secret must contain the Azure Storage Account name and key with the following very specific format with two key-value pairs:
20+
21+
* `azurestorageaccountname`: <storage_account_name>
22+
* `azurestorageaccountkey`: <account_key>
23+
+
24+
To create a secret named _azure-secret_, run the following command:
25+
+
26+
[source,terminal]
27+
----
28+
oc create secret generic azure-secret -n <namespace_name> --type=Opaque --from-literal=azurestorageaccountname="<storage_account_name>" --from-literal=azurestorageaccountkey="<account_key>" <1> <2>
29+
----
30+
<1> Set `<namespace_name>` to the namespace where the PV is consumed.
31+
<2> Provide your values for `<storage_account_name>` and `<account_key>`.
32+
33+
. Create a PV by using the following example YAML file:
34+
+
35+
.Example PV YAML file
36+
[source,yaml]
37+
----
38+
apiVersion: v1
39+
kind: PersistentVolume
40+
metadata:
41+
annotations:
42+
pv.kubernetes.io/provisioned-by: file.csi.azure.com
43+
name: pv-azurefile
44+
spec:
45+
capacity:
46+
storage: 5Gi <1>
47+
accessModes:
48+
- ReadWriteMany <2>
49+
persistentVolumeReclaimPolicy: Retain <3>
50+
storageClassName: <sc-name> <4>
51+
mountOptions:
52+
- dir_mode=0777 <5>
53+
- file_mode=0777
54+
- uid=0
55+
- gid=0
56+
- cache=strict <6>
57+
- nosharesock <7>
58+
- actimeo=30 <8>
59+
- nobrl <9>
60+
csi:
61+
driver: file.csi.azure.com
62+
volumeHandle: "{resource-group-name}#{account-name}#{file-share-name}" <10>
63+
volumeAttributes:
64+
shareName: EXISTING_FILE_SHARE_NAME <11>
65+
nodeStageSecretRef:
66+
name: azure-secret <12>
67+
namespace: <my-namespace> <13>
68+
----
69+
<1> Volume size.
70+
<2> Access mode. Defines the read-write and mount permissions. For more information, under _Additional Resources_, see _Access modes_.
71+
<3> Reclaim policy. Tells the cluster what to do with the volume after it is released. Accepted values are `Retain`, `Recycle`, or `Delete`.
72+
<4> Storage class name. This name is used by the PVC to bind to this specific PV. For static provisioning, a `StorageClass` object does not need to exist, but the name in the PV and PVC must match.
73+
<5> Modify this permission if you want to enhance the security.
74+
<6> Cache mode. Accepted values are `none`, `strict`, and `loose`. The default is `strict`.
75+
<7> Use to reduce the probability of a reconnect race.
76+
<8> The time (in seconds) that the CIFS client caches attributes of a file or directory before it requests attribute information from a server.
77+
<9> Disables sending byte range lock requests to the server, and for applications which have challenges with POSIX locks.
78+
<10> Ensure that `volumeHandle` is unique across the cluster. The `resource-group-name` is the Azure resource group where the storage account resides.
79+
<11> File share name. Use only the file share name; do not use full path.
80+
<12> Provide the name of the secret created in step 1 of this procedure. In this example, it is _azure-secret_.
81+
<13> The namespace that the secret was created in. This must be the namespace where the PV is consumed.
82+
83+
. Create a PVC that references the PV using the following example file:
84+
+
85+
.Example PVC YAML file
86+
[source,yaml]
87+
----
88+
apiVersion: v1
89+
kind: PersistentVolumeClaim
90+
metadata:
91+
name: <pvc-name> <1>
92+
namespace: <my-namespace> <2>
93+
spec:
94+
volumeName: pv-azurefile <3>
95+
storageClassName: <sc-name> <4>
96+
accessModes:
97+
- ReadWriteMany <5>
98+
resources:
99+
requests:
100+
storage: 5Gi <6>
101+
----
102+
<1> PVC name.
103+
<2> Namespace for the PVC.
104+
<3> The name of the PV that you created in the previous step.
105+
<4> Storage class name. This name is used by the PVC to bind to this specific PV. For static provisioning, a `StorageClass` object does not need to exist, but the name in the PV and PVC must match.
106+
<5> Access mode. Defines the requested read-write access for the PVC. Claims use the same conventions as volumes when requesting storage with specific access modes. For more information, under _Additional Resources_, see _Access modes_.
107+
<6> PVC size.
108+
109+
. Ensure that the PVC is created and in `Bound` status after a while by running the following command:
110+
+
111+
[source,terminal]
112+
----
113+
$ oc get pvc <pvc-name> <1>
114+
----
115+
<1> The name of your PVC.
116+
+
117+
.Example output
118+
[source,terminal]
119+
----
120+
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
121+
pvc-name Bound pv-azurefile 5Gi ReadWriteMany my-sc 7m2s
122+
----

storage/container_storage_interface/persistent-storage-csi-azure-file.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ include::modules/persistent-storage-csi-azure-file-nfs.adoc[leveloffset=+1]
2929

3030
include::modules/persistent-storage-csi-about.adoc[leveloffset=+1]
3131

32+
include::modules/persistent-storage-csi-azure-file-static-provisioning-procedure.adoc[leveloffset=+1]
33+
34+
[role="_additional-resources"]
3235
.Additional resources
3336
* xref:../../storage/persistent_storage/persistent-storage-azure-file.adoc#persistent-storage-using-azure-file[Persistent storage using Azure File]
3437
* xref:../../storage/container_storage_interface/persistent-storage-csi.adoc#persistent-storage-csi[Configuring CSI volumes]
38+
* xref:../../storage/understanding-persistent-storage.adoc#pv-access-modes_understanding-persistent-storage[Access modes]

0 commit comments

Comments
 (0)