iidp\345\271\263\345\217\260\345\255\230\345\202\250\346\236\266\346\236\204\344\274\230\345\214\226\346\226\271\346\241\210\357\274\232\351\207\207\347\224\250JuiceFS\346\233\277\344\273\243NFS.md
... ...
@@ -402,4 +402,558 @@ Time used: 6.2 s, CPU: 26.5%, Memory: 310.7 MiB
402 402
| Write into cache | 226 operations | 1.37 ms/op |
403 403
| Read from cache | 229 operations | 5.46 ms/op |
404 404
+------------------+-----------------+---------------+
405
-```
... ...
\ No newline at end of file
0
+```
1
+
2
+### 9. 部署流程
3
+
4
+这里给出一个values.yaml 模板,只是在我测试环境可用,具体参数需要根据实际环境调整,比如私有镜像等。
5
+
6
+```yaml
7
+# Default values for juicefs-csi
8
+# This is a YAML-formatted file
9
+# Declare variables to be passed into your templates
10
+
11
+# Overrides the chart's computed name
12
+# nameOverride: ""
13
+# Overrides the chart's computed fullname
14
+# fullnameOverride: ""
15
+
16
+image:
17
+ repository: dockerhub.kubekey.local/test/juicefs-csi-driver
18
+ tag: "v0.28.3"
19
+ pullPolicy: ""
20
+
21
+dashboardImage:
22
+ repository: dockerhub.kubekey.local/test/csi-dashboard
23
+ tag: "v0.28.3"
24
+ pullPolicy: ""
25
+
26
+sidecars:
27
+ livenessProbeImage:
28
+ repository: dockerhub.kubekey.local/test/livenessprobe
29
+ tag: "v2.12.0"
30
+ pullPolicy: ""
31
+ nodeDriverRegistrarImage:
32
+ repository: dockerhub.kubekey.local/test/csi-node-driver-registrar
33
+ tag: "v2.9.0"
34
+ pullPolicy: ""
35
+ csiProvisionerImage:
36
+ repository: dockerhub.kubekey.local/test/csi-provisioner
37
+ tag: "v2.2.2"
38
+ pullPolicy: ""
39
+ csiResizerImage:
40
+ repository: dockerhub.kubekey.local/test/csi-resizer
41
+ tag: "v1.9.0"
42
+ pullPolicy: ""
43
+
44
+imagePullSecrets: []
45
+
46
+# The way JuiceFS Client runs. choose between:
47
+# - mountpod: default, run JuiceFS Client in an independent pod
48
+# - sidecar: run JuiceFS Client as a sidecar container in the same pod with application
49
+# - process: run JuiceFS Client as a process in the JuiceFS CSI node service
50
+# - serverless: a special "sidecar" mode that requires no privilege, creates no hostPath volumes, to allow full serverless deployment
51
+# Ref: https://juicefs.com/docs/csi/introduction/
52
+mountMode: mountpod
53
+
54
+# The name of the JuiceFS CSI driver
55
+driverName: "csi.juicefs.com"
56
+
57
+# This file contains the configuration options for the JuiceFS CSI driver
58
+# Ref: https://juicefs.com/docs/zh/csi/guide/configurations#configmap
59
+globalConfig:
60
+ # Set to false to disable global config
61
+ enabled: true
62
+
63
+ # Set to true to manage global config by Helm
64
+ # If set to false:
65
+ # 1. the global config will only be applied in the first installation, and will not be updated or deleted by Helm
66
+ # 2. if you want to update it, you need to edit the configmap directly, or use csi-dashboard
67
+ manageByHelm: true
68
+
69
+ # Set to true to schedule mount pod to node with via nodeSelector, rather than nodeName
70
+ enableNodeSelector: false
71
+
72
+ # The mountPodPatch section defines the mount pod spec
73
+ # Each item will be recursively merged into PVC settings according to its pvcSelector
74
+ # If pvcSelector isn't set, the patch will be applied to all PVCs
75
+ # Variable templates are supported, e.g. ${MOUNT_POINT}, ${SUB_PATH}, ${VOLUME_ID}
76
+ mountPodPatch:
77
+
78
+ # Example configurations:
79
+ # - pvcSelector:
80
+ # matchLabels:
81
+ # disable-host-network: "true"
82
+ # hostNetwork: false
83
+
84
+ # - pvcSelector:
85
+ # matchLabels:
86
+ # apply-labels: "true"
87
+ # labels:
88
+ # custom-labels: "asasasa"
89
+
90
+ # - pvcSelector:
91
+ # matchLabels:
92
+ # custom-resources: "true"
93
+ # resources:
94
+ # requests:
95
+ # cpu: 100m
96
+ # memory: 512Mi
97
+
98
+ # - pvcSelector:
99
+ # matchLabels:
100
+ # custom-image: "true"
101
+ # eeMountImage: "juicedata/mount:ee-5.0.17-0c63dc5"
102
+ # ceMountImage: "juicedata/mount:ce-v1.2.0"
103
+
104
+ # - pvcSelector:
105
+ # matchLabels:
106
+ # custom-liveness: "true"
107
+ # livenessProbe:
108
+ # exec:
109
+ # command:
110
+ # - stat
111
+ # - ${MOUNT_POINT}/${SUB_PATH}
112
+ # failureThreshold: 3
113
+ # initialDelaySeconds: 10
114
+ # periodSeconds: 5
115
+ # successThreshold: 1
116
+
117
+# For some environment without DNS server and want to use /etc/hosts instead
118
+# - ip: "127.0.0.1"
119
+# hostnames:
120
+# - "s3.juicefs.local"
121
+# - "redis.juicefs.local"
122
+hostAliases: []
123
+
124
+# The kubelet working directory, can be set using --root-dir when starting kubelet
125
+kubeletDir: /var/lib/kubelet
126
+
127
+# JuiceFS mount directory
128
+jfsMountDir: /var/lib/juicefs/volume
129
+# JuiceFS config directory
130
+jfsConfigDir: /var/lib/juicefs/config
131
+
132
+# Specifies whether JuiceFS is being deployed in an immutable Kubernetes environment.
133
+# Immutable environments, such as Talos Linux, have read-only paths in the host filesystem.
134
+immutable: false
135
+
136
+dnsPolicy: ClusterFirstWithHostNet
137
+dnsConfig: {}
138
+# Example config which uses the AWS nameservers
139
+# dnsPolicy: "None"
140
+# dnsConfig:
141
+# nameservers:
142
+# - 169.254.169.253
143
+
144
+serviceAccount:
145
+ controller:
146
+ # Specifies whether a service account of controller should be created
147
+ create: true
148
+ # Annotations to add to the service account
149
+ annotations: {}
150
+ # The name of the service account to use
151
+ name: "juicefs-csi-controller-sa"
152
+ node:
153
+ # Specifies whether a service account of node service should be created
154
+ create: true
155
+ # Annotations to add to the service account
156
+ annotations: {}
157
+ # The name of the service account to use
158
+ name: "juicefs-csi-node-sa"
159
+ dashboard:
160
+ # Specifies whether a service account of dashboard should be created
161
+ create: true
162
+ # Annotations to add to the service account
163
+ annotations: {}
164
+ # The name of the service account to use
165
+ name: "juicefs-csi-dashboard-sa"
166
+
167
+controller:
168
+ enabled: true
169
+ # Enable verbose logging
170
+ debug: false
171
+ leaderElection:
172
+ # Enable leader election for controller, ref: https://juicefs.com/docs/csi/administration/going-production#leader-election
173
+ enabled: true
174
+ # The namespace where the leader election resource lives. Defaults to the pod namespace if not set
175
+ leaderElectionNamespace: ""
176
+ # The duration that non-leader candidates will wait to force acquire leadership. This is measured against time of last observed ack
177
+ # Defaults to 15s, if not set
178
+ leaseDuration: ""
179
+ # The duration that the acting control-plane will retry refreshing leadership before giving up
180
+ # Enable provisioner of controller service, must be set to true when pathPattern is used
181
+ # Ref: https://juicefs.com/docs/csi/guide/pv/#using-path-pattern
182
+ provisioner: true
183
+ # Cache client auth config file in user's secret, only applicable to JuiceFS EE
184
+ cacheClientConf: true
185
+ replicas: 2
186
+ resources:
187
+ limits:
188
+ cpu: 1000m
189
+ memory: 1Gi
190
+ requests:
191
+ cpu: 100m
192
+ memory: 512Mi
193
+ # Grace period to allow the CSI Controller pod to shutdown before it is killed
194
+ terminationGracePeriodSeconds: 30
195
+ labels: {}
196
+ annotations: {}
197
+ metricsPort: "9567"
198
+ # Affinity for CSI Controller pod
199
+ affinity: {}
200
+ # Node selector for CSI Controller pod
201
+ nodeSelector: {}
202
+ # Tolerations for CSI Controller pod
203
+ tolerations:
204
+ - key: CriticalAddonsOnly
205
+ operator: Exists
206
+ # CSI Controller service
207
+ service:
208
+ port: 9909
209
+ type: ClusterIP
210
+ # PriorityClass name for CSI Controller pod
211
+ priorityClassName: system-cluster-critical
212
+ # -- Extra envs of CSI Controller
213
+ # Example:
214
+ # - name: ENABLE_APISERVER_LIST_CACHE
215
+ # value: "true"
216
+ envs: []
217
+
218
+node:
219
+ # CSI Node Service will be deployed in every node
220
+ enabled: true
221
+ # Enable verbose logging
222
+ debug: false
223
+ hostNetwork: false
224
+ # Set to true to run node-driver-registrar and liveness-probe sidecar in privileged mode (e.g. for SELinux systems)
225
+ sidecarPrivileged: false
226
+ # Enable transparent hugepage tuning
227
+ # Set to true to configure transparent hugepage defrag to 'defer' mode
228
+ tuneTransparentHugePage: false
229
+ resources:
230
+ limits:
231
+ cpu: 1000m
232
+ memory: 1Gi
233
+ requests:
234
+ cpu: 100m
235
+ memory: 512Mi
236
+ # When set true, enable application pods using same sc share the same mount pod
237
+ storageClassShareMount: false
238
+ # When set true, disable mount pods preempt application pods when in resource pressure
239
+ mountPodNonPreempting: false
240
+ # Grace period to allow the CSI Node Service pods to shutdown before it is killed
241
+ terminationGracePeriodSeconds: 30
242
+ labels: {}
243
+ annotations: {}
244
+ metricsPort: "9567"
245
+ # Affinity for CSI Node Service pods
246
+ affinity: {}
247
+ # Node selector for CSI Node Service pods, ref: https://juicefs.com/docs/csi/guide/resource-optimization#csi-node-node-selector
248
+ nodeSelector: {}
249
+ # Tolerations for CSI Node Service pods
250
+ tolerations:
251
+ - key: CriticalAddonsOnly
252
+ operator: Exists
253
+ # PriorityClass name for CSI Node Service pods
254
+ priorityClassName: system-node-critical
255
+ # -- Extra envs of CSI Node
256
+ # Example:
257
+ # - name: ENABLE_APISERVER_LIST_CACHE
258
+ # value: "true"
259
+ envs: []
260
+ updateStrategy:
261
+ rollingUpdate:
262
+ maxUnavailable: 50%
263
+ ifPollingKubelet: true
264
+ livenessProbe:
265
+ failureThreshold: 5
266
+ httpGet:
267
+ path: /healthz
268
+ port: 9909 # numeric value only
269
+ initialDelaySeconds: 10
270
+ periodSeconds: 10
271
+ timeoutSeconds: 3
272
+
273
+# Expose CSI Driver metrics
274
+metrics:
275
+ enabled: false
276
+ port: 8080
277
+ service:
278
+ annotations: {}
279
+ # prometheus.io/scrape: "true"
280
+ # prometheus.io/port: "8080"
281
+ servicePort: 8080
282
+
283
+dashboard:
284
+ # CSI Dashboard helps with CSI Driver observation, enabled by default
285
+ enabled: true
286
+
287
+ # Enable manager for dashboard
288
+ # If enabled, the dashboard will watch and cache k8s resources in the dashboard, which is used to achieve better performance and more features.
289
+ # If disabled, directly obtain resources from the k8s API server when the user accesses the dashboard, which will reduce the pressure on the API server under large-scale clusters.
290
+ enableManager: true
291
+
292
+ # Basic auth for dashboard
293
+ auth:
294
+ enabled: false
295
+ # Set existingSecret to indicate whether to use an existing secret. If it is empty, a corresponding secret will be created according to the plain text configuration.
296
+ existingSecret: ""
297
+ username: admin
298
+ password: admin
299
+
300
+ replicas: 1
301
+ leaderElection:
302
+ # Enable leader election for dashboard.
303
+ enabled: false
304
+ # The namespace where the leader election resource lives. Defaults to the pod namespace if not set
305
+ leaderElectionNamespace: ""
306
+ # The duration that non-leader candidates will wait to force acquire leadership. This is measured against time of last observed ack
307
+ # Defaults to 15s, if not set
308
+ leaseDuration: ""
309
+ # The duration that the acting control-plane will retry refreshing leadership before giving up
310
+ hostNetwork: false
311
+ resources:
312
+ limits:
313
+ cpu: 1000m
314
+ memory: 1Gi
315
+ requests:
316
+ cpu: 100m
317
+ memory: 200Mi
318
+ labels: {}
319
+ annotations: {}
320
+ affinity: {}
321
+ nodeSelector: {}
322
+ tolerations:
323
+ - key: CriticalAddonsOnly
324
+ operator: Exists
325
+ service:
326
+ port: 8088
327
+ type: ClusterIP
328
+ ingress:
329
+ enabled: false
330
+ className: "nginx"
331
+ annotations: {}
332
+ # kubernetes.io/ingress.class: nginx
333
+ # kubernetes.io/tls-acme: "true"
334
+ hosts:
335
+ - host: ""
336
+ paths:
337
+ - path: /
338
+ pathType: ImplementationSpecific
339
+ tls: []
340
+ # - secretName: chart-example-tls
341
+ # hosts:
342
+ # - chart-example.local
343
+ priorityClassName: system-node-critical
344
+ envs: []
345
+
346
+ updateStrategy:
347
+ type: RollingUpdate
348
+ rollingUpdate:
349
+ maxUnavailable: 1
350
+ maxSurge: 25%
351
+
352
+ # Configure the pod level securityContext.
353
+ podSecurityContext: {}
354
+
355
+ # Configure SecurityContext for Pod.
356
+ # Ensure that required linux capability to bind port number below 1024 is assigned (`CAP_NET_BIND_SERVICE`).
357
+ securityContext:
358
+ allowPrivilegeEscalation: false
359
+ capabilities:
360
+ drop:
361
+ - ALL
362
+ readOnlyRootFilesystem: true
363
+
364
+ hostAliases: []
365
+ # - ip: "127.0.0.1"
366
+ # hostnames:
367
+ # - "foo.local"
368
+ # - "bar.local"
369
+
370
+# Override mount image, ref: https://juicefs.com/docs/csi/guide/custom-image/
371
+defaultMountImage:
372
+ ce: "dockerhub.kubekey.local/test/mount:ce-v1.3.0"
373
+ ee: ""
374
+
375
+webhook:
376
+ # Setup the webhook using cert-manager
377
+ certManager:
378
+ enabled: true
379
+ # Helm will auto-generate these fields
380
+ caBundlePEM: |
381
+
382
+ crtPEM: |
383
+
384
+ keyPEM: |
385
+
386
+ # It is recommended that admission webhooks should evaluate as quickly as possible (typically in milliseconds),
387
+ # since they add to API request latency. It is encouraged to use a small timeout for webhooks
388
+ # https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#timeouts
389
+ timeoutSeconds: 5
390
+ # FailurePolicy defines how unrecognized errors and timeout errors from the admission webhook are handled
391
+ # https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#failure-policy
392
+ FailurePolicy: Fail
393
+
394
+validatingWebhook:
395
+ enabled: false
396
+ # It is recommended that admission webhooks should evaluate as quickly as possible (typically in milliseconds),
397
+ # since they add to API request latency. It is encouraged to use a small timeout for webhooks
398
+ # https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#timeouts
399
+ timeoutSeconds: 5
400
+ # FailurePolicy defines how unrecognized errors and timeout errors from the admission webhook are handled
401
+ # https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#failure-policy
402
+ FailurePolicy: Ignore
403
+
404
+# For production environment, manually create & manage storageClass outside Helm is recommended, ref: https://juicefs.com/docs/csi/guide/pv#create-storage-class
405
+storageClasses:
406
+- name: "juicefs-sc"
407
+ # Set to true to actually create this StorageClass
408
+ enabled: false
409
+ # Set existingSecret to indicate whether to use an existing secret. If it is empty, a corresponding secret will be created according to the plain text configuration.
410
+ existingSecret: ""
411
+ # Either Retain or Delete, ref: https://juicefs.com/docs/csi/guide/resource-optimization#reclaim-policy
412
+ reclaimPolicy: Retain
413
+ # Set to true to allow PVC expansion
414
+ allowVolumeExpansion: true
415
+ # Additional annotations for this StorageClass, e.g. make it default
416
+ # annotations:
417
+ # storageclass.kubernetes.io/is-default-class: "true"
418
+
419
+ backend:
420
+ # The JuiceFS file system name
421
+ name: ""
422
+ # Connection URL for metadata engine (e.g. Redis), for community edition use only, ref: https://juicefs.com/docs/community/databases_for_metadata
423
+ metaurl: ""
424
+ # Object storage type, such as s3, gs, oss, for community edition use only, ref: https://juicefs.com/docs/community/how_to_setup_object_storage
425
+ storage: ""
426
+ # Bucket URL, for community edition use only, ref: https://juicefs.com/docs/community/how_to_setup_object_storage
427
+ bucket: ""
428
+ # Token for JuiceFS Enterprise Edition token, ref: https://juicefs.com/docs/cloud/acl
429
+ token: ""
430
+ # Access key for object storage
431
+ accessKey: ""
432
+ # Secret key for object storage
433
+ secretKey: ""
434
+ # Environment variables for the JuiceFS Client
435
+ # Example: {"a": "b"}
436
+ # Ref: https://juicefs.com/docs/csi/guide/pv#volume-credentials
437
+ envs: ""
438
+ # Extra files for the mount pod, ref: https://juicefs.com/docs/csi/guide/pv/#mount-pod-extra-files
439
+ configs: ""
440
+ # The number of days which files are kept in the trash, for community edition use only, ref: https://juicefs.com/docs/community/security/trash
441
+ trashDays: ""
442
+ # Options passed to the "juicefs format" or "juicefs auth" command, depending on which edition you're using
443
+ # Example: block-size=4096,capacity=10
444
+ # Ref: https://juicefs.com/docs/community/command_reference#format and https://juicefs.com/docs/cloud/reference/commands_reference#auth
445
+ formatOptions: ""
446
+
447
+ # Options for the "juicefs mount" command
448
+ # Example:
449
+ # - debug
450
+ # - cache-size=2048
451
+ # - cache-dir=/var/foo
452
+ # Ref: https://juicefs.com/docs/community/command_reference#mount and https://juicefs.com/docs/cloud/reference/commands_reference#mount
453
+ mountOptions:
454
+
455
+ # Customize PV directory format, ref: https://juicefs.com/docs/csi/guide/pv#using-path-pattern
456
+ # If enabled, controller.provisioner must be set to true
457
+ # Example: "${.PVC.namespace}-${.PVC.name}"
458
+ pathPattern: ""
459
+
460
+ # Using PVC as JuiceFS cache path, ref: https://juicefs.com/docs/csi/guide/cache#use-pvc-as-cache-path
461
+ cachePVC: ""
462
+
463
+ mountPod:
464
+ # Mount pod resource requests & limits
465
+ resources:
466
+ limits:
467
+ cpu: 5000m
468
+ memory: 5Gi
469
+ requests:
470
+ cpu: 1000m
471
+ memory: 1Gi
472
+ # Override mount pod image, ref: https://juicefs.com/docs/csi/guide/custom-image
473
+ image: ""
474
+ # Set annotations for the mount pod
475
+ annotations: {}
476
+
477
+```
478
+
479
+#### 1. 在线部署
480
+
481
+如果能够访问公网github,则可以直接参考[官方文档](https://juicefs.com/docs/zh/csi/introduction/)在线部署。
482
+```shell
483
+helm repo add juicefs https://juicedata.github.io/charts/
484
+helm repo update
485
+
486
+# 不论是初次安装还是后续的配置变更,都可以运行这一行命令达到效果
487
+helm upgrade --install juicefs-csi-driver juicefs/juicefs-csi-driver -n kube-system -f ./values.yaml
488
+
489
+```
490
+#### 2. 离线部署
491
+首先需要下载官方[charts](https://github.com/juicedata/charts)
492
+```shell
493
+cd charts\juicefs-csi-driver
494
+
495
+helm install juicefs-csi-driver ./ -n kube-system
496
+
497
+# 查看部署情况
498
+kubectl get pod -n kube-system
499
+
500
+# 输出下面相关的pod
501
+juicefs-csi-controller
502
+juicefs-csi-dashboard
503
+juicefs-csi-node
504
+
505
+```
506
+
507
+#### 3. 部署storageclass
508
+
509
+这里提供的只是一个可参考的模板,具体的参数需要按需替换。
510
+
511
+```yaml
512
+apiVersion: v1
513
+kind: Secret
514
+metadata:
515
+ name: juicefs-secret
516
+ namespace: default
517
+stringData:
518
+ name: "my-juicefs"
519
+ metaurl: "redis://192.168.168.176:6379/5"
520
+ storage: "minio"
521
+ bucket: "http://192.168.184.122:9000/122"
522
+ access-key: "snest"
523
+ secret-key: "snest123"
524
+
525
+---
526
+apiVersion: storage.k8s.io/v1
527
+kind: StorageClass
528
+metadata:
529
+ name: juicefs-sc
530
+provisioner: csi.juicefs.com
531
+parameters:
532
+ csi.storage.k8s.io/provisioner-secret-name: juicefs-secret
533
+ csi.storage.k8s.io/provisioner-secret-namespace: default
534
+ csi.storage.k8s.io/node-publish-secret-name: juicefs-secret
535
+ csi.storage.k8s.io/node-publish-secret-namespace: default
536
+ juicefs/mount-image: dockerhub.kubekey.local/test/mount:ce-v1.3.0
537
+mountOptions:
538
+ - writeback # 异步写,性能更好,但可能存在数据丢失风险,谨慎使用
539
+ - max-uploads=50
540
+ - buffer-size=1024
541
+reclaimPolicy: Retain
542
+```
543
+
544
+```shell
545
+
546
+kubectl apply -f .\juicefs-secret.yaml
547
+
548
+kubectl get sc
549
+# 输出
550
+juicefs-sc csi.juicefs.com
551
+
552
+```
553
+
554
+有了storageclass,就可以创建业务所需的pvc了。
... ...
\ No newline at end of file