Skip to content

Commit bf68f77

Browse files
authored
Merge pull request #1443 from cvvz/fix-wi-doc
chore: fix workload identity docs
2 parents f0a2ddd + e1c8295 commit bf68f77

File tree

1 file changed

+90
-1
lines changed

1 file changed

+90
-1
lines changed

docs/workload-identity-static-pv-mount.md

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,96 @@ az identity federated-credential create --name $FEDERATED_IDENTITY_NAME \
5959
--issuer $AKS_OIDC_ISSUER \
6060
--subject system:serviceaccount:${SERVICE_ACCOUNT_NAMESPACE}:${SERVICE_ACCOUNT_NAME}
6161
```
62-
## Pod with ephemeral inline volume
62+
63+
## option#1: static provision with PV
64+
```
65+
cat <<EOF | kubectl apply -f -
66+
apiVersion: v1
67+
kind: PersistentVolume
68+
metadata:
69+
annotations:
70+
pv.kubernetes.io/provisioned-by: blob.csi.azure.com
71+
name: pv-blob
72+
spec:
73+
capacity:
74+
storage: 10Gi
75+
accessModes:
76+
- ReadWriteMany
77+
persistentVolumeReclaimPolicy: Retain
78+
storageClassName: blob-fuse
79+
mountOptions:
80+
- -o allow_other
81+
- --file-cache-timeout-in-seconds=120
82+
csi:
83+
driver: blob.csi.azure.com
84+
# make sure volumeid is unique for every storage blob container in the cluster
85+
# the # character is reserved for internal use, the / character is not allowed
86+
volumeHandle: unique_volume_id
87+
volumeAttributes:
88+
storageaccount: $ACCOUNT # required
89+
containerName: $CONTAINER # required
90+
clientID: $USER_ASSIGNED_CLIENT_ID # required
91+
resourcegroup: $STORAGE_RESOURCE_GROUP # optional, specified when the storage account is not under AKS node resource group(which is prefixed with "MC_")
92+
# tenantID: $IDENTITY_TENANT #optional, only specified when workload identity and AKS cluster are in different tenant
93+
# subscriptionid: $SUBSCRIPTION #optional, only specified when workload identity and AKS cluster are in different subscription
94+
---
95+
kind: PersistentVolumeClaim
96+
apiVersion: v1
97+
metadata:
98+
name: pvc-blob
99+
spec:
100+
accessModes:
101+
- ReadWriteMany
102+
resources:
103+
requests:
104+
storage: 10Gi
105+
volumeName: pv-blob
106+
storageClassName: blob-fuse
107+
---
108+
apiVersion: apps/v1
109+
kind: Deployment
110+
metadata:
111+
labels:
112+
app: nginx
113+
name: deployment-blob
114+
spec:
115+
replicas: 1
116+
selector:
117+
matchLabels:
118+
app: nginx
119+
template:
120+
metadata:
121+
labels:
122+
app: nginx
123+
name: deployment-blob
124+
spec:
125+
serviceAccountName: $SERVICE_ACCOUNT_NAME #required, Pod has no permission to mount the volume without this field
126+
nodeSelector:
127+
"kubernetes.io/os": linux
128+
containers:
129+
- name: deployment-blob
130+
image: mcr.microsoft.com/oss/nginx/nginx:1.17.3-alpine
131+
command:
132+
- "/bin/sh"
133+
- "-c"
134+
- while true; do echo $(date) >> /mnt/blob/outfile; sleep 1; done
135+
volumeMounts:
136+
- name: blob
137+
mountPath: "/mnt/blob"
138+
readOnly: false
139+
volumes:
140+
- name: blob
141+
persistentVolumeClaim:
142+
claimName: pvc-blob
143+
strategy:
144+
rollingUpdate:
145+
maxSurge: 0
146+
maxUnavailable: 1
147+
type: RollingUpdate
148+
EOF
149+
```
150+
151+
## option#2: Pod with ephemeral inline volume
63152
```
64153
cat <<EOF | kubectl apply -f -
65154
kind: Pod

0 commit comments

Comments
 (0)