You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/en/guide/cache.md
+57-8Lines changed: 57 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,22 +12,50 @@ With CSI Driver, you can use either a host directory or a PVC for cache storage.
12
12
* If all worker nodes are used to run JuiceFS Mount Pods, and they host similar cache content (similar situation if you use distributed caching), Pod migration is not really a problem, and you can still use host directories for cache storage.
13
13
* When using a PVC for cache storage, different JuiceFS PVs can isolate cache data. If the Mount Pod is migrated to another node, the PVC reference remains the same. This ensures that the cache is unaffected.
14
14
15
-
## Using host directories (`hostPath`) {#cache-settings}
15
+
## Using host path (`hostPath`) {#cache-settings}
16
16
17
-
For Kubernetes nodes, a dedicated disk is often used as data and cache storage, be sure to properly configure the cache directory, or JuiceFS cache will by default be written to `/var/jfsCache`, which can easily eat up system storage space.
17
+
By default, CSI Driver uses the standard JuiceFS Client cache directory `/var/jfsCache` on the host, if you intend to use data disk as cache storage, make sure the correct path is configured, otherwise cache can drain the system disk.
18
18
19
-
After the cache directory is set, it will be accessible in the Mount Pod via `hostPath`. You might also need to configure other cache-related options (like `--cache-size`) according to [Adjust mount options](./configurations.md#mount-options).
19
+
Specify `--cache-dir` in mount options, preferably in ConfigMap, and then CSI Driver will handle the mounts accordingly:
20
+
21
+
```yaml {6} title="values-mycluster.yaml"
22
+
...
23
+
globalConfig:
24
+
enabled: true
25
+
mountPodPatch:
26
+
- mountOptions:
27
+
- cache-dir=/data/cache
28
+
- cache-size=10T
29
+
```
30
+
31
+
When Mount Pod starts, it will include the hostPath mounts:
32
+
33
+
```yaml {4,9}
34
+
...
35
+
volumeMounts:
36
+
...
37
+
- mountPath: /data/cache
38
+
name: cachedir-0
39
+
volumes:
40
+
...
41
+
- hostPath:
42
+
path: /data/cache
43
+
type: DirectoryOrCreate
44
+
name: cachedir-0
45
+
```
46
+
47
+
If you need to further customize cache related options, check out the option list in [JuiceFS Community Edition](https://juicefs.com/docs/community/command_reference/#mount) and [JuiceFS Cloud Service](https://juicefs.com/docs/cloud/reference/commands_reference/#mount).
20
48
21
49
:::note
22
50
23
-
* In CSI Driver, `cache-dir` parameter does not support wildcard character, if you need to use multiple disks as storage devices, specify multiple directories joined by the `:` character. See [JuiceFS Community Edition](https://juicefs.com/docs/community/command_reference/#mount) and [JuiceFS Cloud Service](https://juicefs.com/docs/cloud/reference/commands_reference/#mount).
51
+
* In CSI Driver, `cache-dir` parameter does not support wildcard character, if you need to use multiple disks as storage devices, specify multiple directories joined by the `:` character.
24
52
* For scenarios that involve intensive small writes, we usually recommend users to temporarily enable client write cache, but due to its inherent risks, this is advised against when using CSI Driver, because Pod lifecycle is significantly more unstable, and can cause data loss if Pod exists unexpectedly.
From 0.15.1 and above, JuiceFS CSI Driver supports using a PVC as cache directory. This is often used in hosted Kubernetes clusters provided by cloud services, which allows you to use a dedicated cloud disk as cache storage for CSI Driver.
112
+
If you have higher demands for cache isolation, or cannot use hostPath for cache due to other reasons, consider using PVC as cache storage.
85
113
86
-
First, create a PVC according to your cloud service provider's manual, for example:
114
+
PVC should be created in advance, and if you are using one of the following service providers, you can refer to their manual:
* [Use the Azure Disks CSI Driver in Azure Kubernetes Service (AKS)](https://learn.microsoft.com/en-us/azure/aks/azure-disk-csi)
90
118
* [Using the Google Compute Engine persistent disk CSI Driver](https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/gce-pd-csi-driver)
For custom volumes, make sure `mountPath` and `hostPath` doesn't contain duplicates, to avoid conflicts.
123
+
:::
124
+
93
125
Assuming a PVC named `jfs-cache-pvc` is already created in the same namespace as the Mount Pod (which defaults to `kube-system`), use the following example to set this PVC as the cache directory for JuiceFS CSI Driver.
0 commit comments