doc: add windows feature doc

Signed-off-by: ZeroMagic <anthonyliu@zju.edu.cn>
This commit is contained in:
ZeroMagic 2020-03-28 05:52:30 +00:00
parent 20bc655318
commit 6364ceb78c
8 changed files with 296 additions and 2 deletions

View File

@ -35,6 +35,7 @@ Please refer to [install azurefile csi driver](https://github.com/kubernetes-sig
- [Basic usage](./deploy/example/e2e_usage.md)
- [Snapshot](./deploy/example/snapshot)
- [VHD disk](./deploy/example/disk)
- [Windows](./deploy/example/windows)
## Kubernetes Development
Please refer to [development guide](./docs/csi-dev.md)

View File

@ -0,0 +1,142 @@
---
kind: DaemonSet
apiVersion: apps/v1
metadata:
name: csi-azurefile-node-win
namespace: kube-system
spec:
selector:
matchLabels:
app: csi-azurefile-node-win
template:
metadata:
labels:
app: csi-azurefile-node-win
spec:
nodeSelector:
kubernetes.io/os: windows
priorityClassName: system-node-critical
containers:
- name: liveness-probe
volumeMounts:
- mountPath: C:\csi
name: plugin-dir
image: mcr.microsoft.com/oss/kubernetes-csi/livenessprobe:master
args:
- --csi-address=$(CSI_ENDPOINT)
- --probe-timeout=3s
- --health-port=29613
- --v=5
env:
- name: CSI_ENDPOINT
value: unix://C:\\csi\\csi.sock
resources:
limits:
cpu: 200m
memory: 200Mi
requests:
cpu: 10m
memory: 20Mi
- name: node-driver-registrar
image: mcr.microsoft.com/oss/kubernetes-csi/csi-node-driver-registrar:master
args:
- --v=5
- --csi-address=$(CSI_ENDPOINT)
- --kubelet-registration-path=C:\\var\\lib\\kubelet\\plugins\\file.csi.azure.com\\csi.sock
env:
- name: CSI_ENDPOINT
value: unix://C:\\csi\\csi.sock
- name: KUBE_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
volumeMounts:
- name: kubelet-dir
mountPath: "C:\\var\\lib\\kubelet"
- name: plugin-dir
mountPath: C:\csi
- name: registration-dir
mountPath: C:\registration
resources:
limits:
cpu: 200m
memory: 200Mi
requests:
cpu: 10m
memory: 20Mi
- name: azurefile
image: mcr.microsoft.com/k8s/csi/azurefile-csi:latest
args:
- --v=5
- --endpoint=$(CSI_ENDPOINT)
- --nodeid=$(KUBE_NODE_NAME)
ports:
- containerPort: 29613
name: healthz
protocol: TCP
- containerPort: 29615
name: metrics
protocol: TCP
livenessProbe:
failureThreshold: 5
httpGet:
path: /healthz
port: healthz
initialDelaySeconds: 30
timeoutSeconds: 10
periodSeconds: 30
env:
- name: AZURE_CREDENTIAL_FILE
value: "C:\\k\\azure.json"
- name: CSI_ENDPOINT
value: unix://C:\\csi\\csi.sock
- name: KUBE_NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
securityContext:
privileged: true
volumeMounts:
- name: kubelet-dir
mountPath: "C:\\var\\lib\\kubelet"
- name: plugin-dir
mountPath: C:\csi
- name: azure-config
mountPath: C:\k
- name: csi-proxy-fs-pipe
mountPath: \\.\pipe\csi-proxy-filesystem-v1alpha1
- name: csi-proxy-smb-pipe
mountPath: \\.\pipe\csi-proxy-smb-v1alpha1
resources:
limits:
cpu: 200m
memory: 200Mi
requests:
cpu: 10m
memory: 20Mi
volumes:
- name: csi-proxy-fs-pipe
hostPath:
path: \\.\pipe\csi-proxy-filesystem-v1alpha1
type: ""
- name: csi-proxy-smb-pipe
hostPath:
path: \\.\pipe\csi-proxy-smb-v1alpha1
type: ""
- name: registration-dir
hostPath:
path: C:\var\lib\kubelet\plugins_registry\
type: Directory
- name: kubelet-dir
hostPath:
path: C:\var\lib\kubelet\
type: Directory
- name: plugin-dir
hostPath:
path: C:\var\lib\kubelet\plugins\file.csi.azure.com\
type: DirectoryOrCreate
- name: azure-config
hostPath:
path: C:\k
type: Directory

View File

@ -0,0 +1,55 @@
# CSI on Windows example
## Feature Status: Alpha
CSI on Windows support is an alpha feature since Kubernetes v1.18, refer to [Windows-CSI-Support](https://github.com/kubernetes/enhancements/blob/master/keps/sig-windows/20190714-windows-csi-support.md) for more details.
## Prerequisite
- Install CSI-Proxy on Windows Node
[csi-proxy installation](https://github.com/Azure/aks-engine/blob/master/docs/topics/csi-proxy-windows.md) is supported with [aks-engine v0.48.0](https://github.com/Azure/aks-engine/releases/tag/v0.48.0).
## Install CSI Driver
Follow the [instructions](https://github.com/kubernetes-sigs/azurefile-csi-driver/blob/master/docs/install-csi-driver-master.md#windows) to install windows version driver.
## Deploy a Windows pod with PVC mount
### Create StorageClass
```
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/example/storageclass-azurefile-csi.yaml
```
### Create Windows pod
```
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/example/windows/statefulset.yaml
```
### Enter pod container to do validation
```
$ kubectl exec -it aspnet-azurefile-0 -- cmd
Microsoft Windows [Version 10.0.17763.1098]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\inetpub\wwwroot>cd c:\mnt\azurefile
c:\mnt\azurefile>echo hello > 20200328
c:\mnt\azurefile>dir
Volume in drive C has no label.
Volume Serial Number is DE36-B78A
Directory of c:\mnt\azurefile
03/28/2020 05:48 AM <DIR> .
03/28/2020 05:48 AM <DIR> ..
03/28/2020 05:49 AM 8 20200328
1 File(s) 8 bytes
2 Dir(s) 107,374,116,864 bytes free
```
In the above example, there is a `c:\mnt\azurefile` directory mounted as NTFS filesystem.

View File

@ -0,0 +1,42 @@
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-azurefile
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 100Gi
storageClassName: file.csi.azure.com
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: aspnet-azurefile
labels:
app: aspnet
spec:
replicas: 1
template:
metadata:
name: aspnet
labels:
app: aspnet
spec:
nodeSelector:
"kubernetes.io/os": windows
containers:
- name: aspnet
image: mcr.microsoft.com/dotnet/framework/samples:aspnetapp
volumeMounts:
- name: azurefile
mountPath: "/mnt/azurefile"
volumes:
- name: azurefile
persistentVolumeClaim:
claimName: pvc-azurefile
selector:
matchLabels:
app: aspnet

View File

@ -0,0 +1,38 @@
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: aspnet-azurefile
labels:
app: aspnet
spec:
serviceName: aspnet-azurefile
replicas: 1
template:
metadata:
labels:
app: aspnet
spec:
nodeSelector:
"kubernetes.io/os": windows
containers:
- name: aspnet-azurefile
image: mcr.microsoft.com/dotnet/framework/samples:aspnetapp
volumeMounts:
- name: persistent-storage
mountPath: /mnt/azurefile
updateStrategy:
type: RollingUpdate
selector:
matchLabels:
app: aspnet
volumeClaimTemplates:
- metadata:
name: persistent-storage
annotations:
volume.beta.kubernetes.io/storage-class: file.csi.azure.com
spec:
accessModes: ["ReadWriteMany"]
resources:
requests:
storage: 100Gi

View File

@ -31,4 +31,11 @@ kubectl apply -f $repo/crd-csi-node-info.yaml
kubectl apply -f $repo/rbac-csi-azurefile-controller.yaml
kubectl apply -f $repo/csi-azurefile-controller.yaml
kubectl apply -f $repo/csi-azurefile-node.yaml
if [[ "$#" -gt 1 ]]; then
if [[ "$2" = "windows" ]]; then
echo "Install Azure File CSI Windows driver ..."
kubectl apply -f $repo/csi-azurefile-node-windows.yaml
fi
fi
echo 'Azure File CSI driver installed successfully.'

View File

@ -18,7 +18,15 @@ kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/csi-azurefile-node.yaml
```
- check pods status:
- Enable Windows support
> Note: Windows CSI driver is in alpha stage.
```
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/csi-azurefile-node-windows.yaml
```
### check pods status:
```console
kubectl -n kube-system get pod -o wide --watch -l app=csi-azurefile-controller
@ -49,4 +57,5 @@ kubectl delete -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-cs
kubectl delete -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/crd-csi-driver-registry.yaml --ignore-not-found
kubectl delete -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/crd-csi-node-info.yaml --ignore-not-found
kubectl delete -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/rbac-csi-azurefile-controller.yaml --ignore-not-found
kubectl delete -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/csi-azurefile-node-windows.yaml
```

View File

@ -21,7 +21,7 @@ fi
LOG=/tmp/yamllint.log
helmPath=charts/latest/azurefile-csi-driver/templates
for path in "deploy/*.yaml" "deploy/example/*.yaml" "deploy/example/snapshot/*.yaml" "deploy/example/disk/*.yaml"
for path in "deploy/*.yaml" "deploy/example/*.yaml" "deploy/example/snapshot/*.yaml" "deploy/example/disk/*.yaml" "deploy/example/windows/*.yaml"
do
echo "checking yamllint under path: $path ..."
yamllint -f parsable $path | grep -v "line too long" > $LOG