From 20aa33b9155ae11386d5b290bd6c370d1da1c4aa Mon Sep 17 00:00:00 2001 From: Stavros Kontopoulos Date: Tue, 7 Nov 2023 09:46:42 +0200 Subject: [PATCH] Finalize pvc support (#5651) * pvc support * comments * fixes * fix --- docs/serving/services/storage.md | 34 +++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/docs/serving/services/storage.md b/docs/serving/services/storage.md index e7546e3ec0..95d3ff563a 100644 --- a/docs/serving/services/storage.md +++ b/docs/serving/services/storage.md @@ -1,12 +1,36 @@ # Volume Support for Knative services -By default Serving supports the mounting the [volume types](https://kubernetes.io/docs/concepts/storage/volumes): `emptyDir`, `secret`, `configMap` and `projected`. [PersistentVolumes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/) are supported but require a [feature flag](../configuration/feature-flags.md) to be enabled. +You can provide data storage for Knative Services by configuring different volumes types. +Serving supports mounting the [volume types](https://kubernetes.io/docs/concepts/storage/volumes): `emptyDir`, `secret`, `configMap` and `projected`. +[PersistentVolumes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/) are supported but require a [feature flag](../configuration/feature-flags.md) to be enabled. !!! warning + Mounting large volumes may add considerable overhead to the application's start up time. -Here is an example of using a persistent volume claim with a Knative Service: +Bellow there is an example of using a persistent volume claim with a Knative Service. + +## Prerequisites + +Before you can configure PVCs for a Service, this feature must be enabled in the `config-features` ConfigMap as follows: + +``` +kubectl patch --namespace knative-serving configmap/config-features \ + --type merge \ + --patch '{"data":{"kubernetes.podspec-persistent-volume-claim": "enabled", "kubernetes.podspec-persistent-volume-write": "enabled"}}' +``` + +* The `kubernetes.podspec-persistent-volume-claim` extension controls whether persistent volumes (PVs) can be used with Knative Serving. +* The `kubernetes.podspec-persistent-volume-write` extension controls whether PVs are available to Knative Serving with the write access. + +!!! note + + If you have installed Serving via the Knative operator then you need to set the above feature flags **only** at the corresponding Serving CR. + +## Procedure + +* Modify the PVC configuration for your Service: ```yaml apiVersion: serving.knative.dev/v1 @@ -16,8 +40,8 @@ spec: template: spec: containers: - ... - volumeMounts: + ... + volumeMounts: - mountPath: /data name: mydata readOnly: false @@ -37,4 +61,4 @@ spec: resources: requests: storage: 1Gi -``` +``` \ No newline at end of file