Configure Deployment resources

The config-deployment ConfigMap, known as the Deployment ConfigMap, contains settings that determine how Kubernetes Deployment resources, which back Knative services, are configured. This ConfigMap is located in the knative-serving namespace.

You can view the current config-deployment ConfigMap by running the following command:

  1. kubectl get configmap -n knative-serving config-deployment -oyaml

Example config-deployment ConfigMap

  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: config-deployment
  5. namespace: knative-serving
  6. labels:
  7. serving.knative.dev/release: devel
  8. annotations:
  9. knative.dev/example-checksum: "fa67b403"
  10. data:
  11. # This is the Go import path for the binary that is containerized
  12. # and substituted here.
  13. queue-sidecar-image: ko://knative.dev/serving/cmd/queue
  14. # List of repositories for which tag to digest resolving should be skipped
  15. registries-skipping-tag-resolving: "kind.local,ko.local,dev.local"
  16. # digest-resolution-timeout is the maximum time allowed for an image's
  17. # digests to be resolved.
  18. digest-resolution-timeout: "10s"
  19. # progress-deadline is the duration we wait for the deployment to
  20. # be ready before considering it failed.
  21. progress-deadline: "600s"
  22. # queue-sidecar-cpu-request is the requests.cpu to set for the queue proxy sidecar container.
  23. # If omitted, a default value (currently "25m"), is used.
  24. queue-sidecar-cpu-request: "25m"
  25. # queue-sidecar-cpu-limit is the limits.cpu to set for the queue proxy sidecar container.
  26. # If omitted, no value is specified and the system default is used.
  27. queue-sidecar-cpu-limit: "1000m"
  28. # queue-sidecar-memory-request is the requests.memory to set for the queue proxy container.
  29. # If omitted, no value is specified and the system default is used.
  30. queue-sidecar-memory-request: "400Mi"
  31. # queue-sidecar-memory-limit is the limits.memory to set for the queue proxy container.
  32. # If omitted, no value is specified and the system default is used.
  33. queue-sidecar-memory-limit: "800Mi"
  34. # queue-sidecar-ephemeral-storage-request is the requests.ephemeral-storage to
  35. # set for the queue proxy sidecar container.
  36. # If omitted, no value is specified and the system default is used.
  37. queue-sidecar-ephemeral-storage-request: "512Mi"
  38. # queue-sidecar-ephemeral-storage-limit is the limits.ephemeral-storage to set
  39. # for the queue proxy sidecar container.
  40. # If omitted, no value is specified and the system default is used.
  41. queue-sidecar-ephemeral-storage-limit: "1024Mi"
  42. # concurrency-state-endpoint is the endpoint that queue-proxy calls when its traffic drops to zero or
  43. # scales up from zero.
  44. concurrency-state-endpoint: ""

Configuring progress deadlines

Configuring progress deadline settings allows you to specify the maximum time, either in seconds or minutes, that you will wait for your Deployment to progress before the system reports back that the Deployment has failed progressing for the Knative Revision.

The default progress deadline is 600 seconds. This value is expressed as a Golang time.Duration string representation, and must be rounded to a second precision.

The Knative Autoscaler component scales the revision to 0, and the Knative service enters a terminal Failed state, if the initial scale cannot be achieved within the time limit defined by this setting.

You may want to configure this setting as a higher value if any of the following issues occur in your Knative deployment:

  • It takes a long time to pull the Service image, due to the size of the image.
  • It takes a long time for the Service to become READY, due to priming of the initial cache state.
  • The cluster is relies on cluster autoscaling to allocate resources for new pods.

See the Kubernetes documentation for more information.

The following example shows a snippet of an example Deployment Config Map that sets this value to 10 minutes:

  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: config-deployment
  5. namespace: knative-serving
  6. labels:
  7. serving.knative.dev/release: devel
  8. annotations:
  9. knative.dev/example-checksum: "fa67b403"
  10. data:
  11. progress-deadline: "10m"

Skipping tag resolution

You can configure Knative Serving to skip tag resolution for Deployments by modifying the registries-skipping-tag-resolving ConfigMap setting.

The following example shows how to disable tag resolution for registry.example.com:

  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: config-deployment
  5. namespace: knative-serving
  6. labels:
  7. serving.knative.dev/release: devel
  8. annotations:
  9. knative.dev/example-checksum: "fa67b403"
  10. data:
  11. # List of repositories for which tag to digest resolving should be skipped
  12. registries-skipping-tag-resolving: registry.example.com

Enable container-freezer service

You can configure queue-proxy to pause pods when not in use by enabling the container-freezer service. It calls a stand-alone service (via a user-specified endpoint) when a pod’s traffic drops to zero or scales up from zero. To enable it, set concurrency-state-endpoint to a non-empty value. With this configuration, you can achieve some features like freezing running processes in pods or billing based on the time it takes to process the requests.

Before you configure this, you need to implement the endpoint API. The official implementation is container-freezer. You can install it by following the installation instructions in the container-freezer README.

The following example shows how to enable the container-freezer service. When using $HOST_IP, the container-freezer service inserts the appropriate value for each node at runtime:

  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: config-deployment
  5. namespace: knative-serving
  6. labels:
  7. serving.knative.dev/release: devel
  8. annotations:
  9. knative.dev/example-checksum: "fa67b403"
  10. data:
  11. concurrency-state-endpoint: "http://$HOST_IP:9696"