mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-13 11:25:19 +00:00
support Azure File Service volume
Signed-off-by: Huamin Chen <hchen@redhat.com>
This commit is contained in:
64
examples/azure_file/README.md
Normal file
64
examples/azure_file/README.md
Normal file
@@ -0,0 +1,64 @@
|
||||
<!-- BEGIN MUNGE: UNVERSIONED_WARNING -->
|
||||
|
||||
<!-- BEGIN STRIP_FOR_RELEASE -->
|
||||
|
||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
||||
width="25" height="25">
|
||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
||||
width="25" height="25">
|
||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
||||
width="25" height="25">
|
||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
||||
width="25" height="25">
|
||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
||||
width="25" height="25">
|
||||
|
||||
<h2>PLEASE NOTE: This document applies to the HEAD of the source tree</h2>
|
||||
|
||||
If you are using a released version of Kubernetes, you should
|
||||
refer to the docs that go with that version.
|
||||
|
||||
Documentation for other releases can be found at
|
||||
[releases.k8s.io](http://releases.k8s.io).
|
||||
</strong>
|
||||
--
|
||||
|
||||
<!-- END STRIP_FOR_RELEASE -->
|
||||
|
||||
<!-- END MUNGE: UNVERSIONED_WARNING -->
|
||||
|
||||
# How to Use it?
|
||||
|
||||
Install *cifs-utils* on the Kubernetes host. For example, on Fedora based Linux
|
||||
|
||||
# yum -y install cifs-utils
|
||||
|
||||
Note, as explained in [Azure File Storage for Linux](https://azure.microsoft.com/en-us/documentation/articles/storage-how-to-use-files-linux/), the Linux hosts and the file share must be in the same Azure region.
|
||||
|
||||
Obtain an Microsoft Azure storage account and create a [secret](secret/azure-secret.yaml) that contains the base64 encoded Azure Storage account name and key. In the secret file, base64-encode Azure Storage account name and pair it with name *azurestorageaccountname*, and base64-encode Azure Storage access key and pair it with name *azurestorageaccountkey*.
|
||||
|
||||
Then create a Pod using the volume spec based on [azure](azure.yaml).
|
||||
|
||||
In the pod, you need to provide the following information:
|
||||
|
||||
- *secretName*: the name of the secret that contains both Azure storage account name and key.
|
||||
- *shareName*: The share name to be used.
|
||||
- *readOnly*: Whether the filesystem is used as readOnly.
|
||||
|
||||
Create the secret:
|
||||
|
||||
```console
|
||||
# kubectl create -f examples/azure_file/secret/azure-secret.yaml
|
||||
```
|
||||
|
||||
You should see the account name and key from `kubectl get secret`
|
||||
|
||||
Then create the Pod:
|
||||
|
||||
```console
|
||||
# kubectl create -f examples/azure_file/azure.yaml
|
||||
```
|
||||
|
||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||
[]()
|
||||
<!-- END MUNGE: GENERATED_ANALYTICS -->
|
||||
17
examples/azure_file/azure.yaml
Normal file
17
examples/azure_file/azure.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: azure
|
||||
spec:
|
||||
containers:
|
||||
- image: kubernetes/pause
|
||||
name: azure
|
||||
volumeMounts:
|
||||
- name: azure
|
||||
mountPath: /mnt/azure
|
||||
volumes:
|
||||
- name: azure
|
||||
azureFile:
|
||||
secretName: azure-secret
|
||||
shareName: k8stest
|
||||
readOnly: false
|
||||
8
examples/azure_file/secret/azure-secret.yaml
Normal file
8
examples/azure_file/secret/azure-secret.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: azure-secret
|
||||
type: Opaque
|
||||
data:
|
||||
azurestorageaccountname: azhzdGVzdA==
|
||||
azurestorageaccountkey: eElGMXpKYm5ub2pGTE1Ta0JwNTBteDAyckhzTUsyc2pVN21GdDRMMTNob0I3ZHJBYUo4akQ2K0E0NDNqSm9nVjd5MkZVT2hRQ1dQbU02WWFOSHk3cWc9PQ==
|
||||
@@ -402,6 +402,9 @@ func TestExampleObjectSchemas(t *testing.T) {
|
||||
"redis-service": &api.Service{},
|
||||
"job": &extensions.Job{},
|
||||
},
|
||||
"../examples/azure_file": {
|
||||
"azure": &api.Pod{},
|
||||
},
|
||||
}
|
||||
|
||||
capabilities.SetForTests(capabilities.Capabilities{
|
||||
|
||||
Reference in New Issue
Block a user