|
| 1 | +:_content-type: PROCEDURE |
| 2 | +[id="serverless-configuring-queue-proxy_{context}"] |
| 3 | += Configuring Queue Proxy Resources for a Knative Service |
| 4 | + |
| 5 | +Apart from configuring the Queue Proxy resource requests and limits globally in the deployment configmap, you can set them at the service level using the corresponding annotations targeting CPU, memory, and ephemeral storage resource types. |
| 6 | + |
| 7 | +.Prerequisites |
| 8 | + |
| 9 | +* {pipelines-title} must be installed on your cluster. |
| 10 | +
|
| 11 | +* You have installed the OpenShift (`oc`) CLI. |
| 12 | +
|
| 13 | +* You have installed the Knative (`kn`) CLI. |
| 14 | +
|
| 15 | +.Procedure |
| 16 | + |
| 17 | +* Modify the configmap of your service with resource requests and limits: |
| 18 | ++ |
| 19 | +[source,yaml] |
| 20 | +---- |
| 21 | +apiVersion: serving.knative.dev/v1 |
| 22 | +kind: Service |
| 23 | +metadata: |
| 24 | + name: example-service |
| 25 | + namespace: default |
| 26 | +spec: |
| 27 | + template: |
| 28 | + metadata: |
| 29 | + annotations: |
| 30 | + queue.sidecar.serving.knative.dev/cpu-resource-request: "1" |
| 31 | + queue.sidecar.serving.knative.dev/cpu-resource-limit: "2" |
| 32 | + queue.sidecar.serving.knative.dev/memory-resource-request: "1Gi" |
| 33 | + queue.sidecar.serving.knative.dev/memory-resource-limit: "2Gi" |
| 34 | + queue.sidecar.serving.knative.dev/ephemeral-storage-resource-request: "400Mi" |
| 35 | + queue.sidecar.serving.knative.dev/ephemeral-storage-resource-limit: "450Mi" |
| 36 | +---- |
| 37 | ++ |
| 38 | +Alternatively, you can use the special `queue.sidecar.serving.knative.dev/resource-percentage` annotation, which calculates the Queue Proxy resources as a percentage of the application container. When CPU and memory resource requirements are calculated from the application container requirements and they are outside the boundaries below, the values are adjusted to fit within the boundaries. In this case, the following minimum and maximum boundaries are applied to the CPU and memory resource requirements: |
| 39 | ++ |
| 40 | +.Resource requirements boundaries |
| 41 | +[cols="2,1,1",options="header"] |
| 42 | +|==== |
| 43 | +|Resource requirements|Min|Max |
| 44 | +
|
| 45 | +|CPU request |
| 46 | +|25m |
| 47 | +|100m |
| 48 | + |
| 49 | +|CPU limit |
| 50 | +|40m |
| 51 | +|500m |
| 52 | + |
| 53 | +|Memory request |
| 54 | +|50Mi |
| 55 | +|200Mi |
| 56 | + |
| 57 | +|Memory limit |
| 58 | +|200Mi |
| 59 | +|500Mi |
| 60 | + |
| 61 | +|==== |
| 62 | ++ |
| 63 | +[NOTE] |
| 64 | +==== |
| 65 | +If you simultaneously set a percentage annotation and a specific resource value using the corresponding resource annotation, then the latter takes precedence. |
| 66 | +==== |
| 67 | ++ |
| 68 | +[WARNING] |
| 69 | +==== |
| 70 | +The `queue.sidecar.serving.knative.dev/resource-percentage` annotation is now deprecated and will be removed in a future version of {ServerlessProductName}. |
| 71 | +==== |
0 commit comments