Skip to content

Administrator configuration options

If you have cluster administrator permissions for your Knative installation, you can modify ConfigMaps to change the global default configuration options for Revisions of Knative Services on the cluster.

Garbage collection

When Revisions of a Knative Service are inactive, they are automatically cleaned up and cluster resources are reclaimed after a set time period. This is known as garbage collection.

You can configure garbage collection parameters a specific Revision if you are a developer. You can also configure default, cluster-wide garbage collection parameters for all the Revisions of all the Services on a cluster if you have cluster administrator permissions.

You can set cluster-wide garbage collection configurations for your cluster by modifying the config-gc ConfigMap.

The following garbage collection settings can be modified:

Name Description
retain-since-create-time The time that must have elapsed since a Revision was created before a Revision is considered for garbage collection.
retain-since-last-active-time The time that must have elapsed since a Revision was last active before a Revision is considered for garbage collection.
min-non-active-revisions The minimum number of inactive Revisions to retain.
max-non-active-revisions The maximum number of inactive Revisions to retain.

Revisions are always retained if they belong to any one of the following categories:

  • The Revision is active and is being reference by a Route.
  • The Revision was created within the time specified by the retain-since-create-time setting.
  • The Revision was last referenced by a Route within the time specified by the retain-since-last-active-time setting.
  • There are fewer existing Revisions than the number specified by the min-non-active-revisions setting.

Examples

  • Immediately clean up any inactive Revisions:

    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: config-gc
      namespace: knative-serving
    data:
      min-non-active-revisions: "0"
      max-non-active-revisions: "0"
      retain-since-create-time: "disabled"
      retain-since-last-active-time: "disabled"
    ...
    
  • Retain the last ten inactive revisions:

    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: config-gc
      namespace: knative-serving
    data:
      retain-since-create-time: "disabled"
      retain-since-last-active-time: "disabled"
      max-non-active-revisions: "10"
    ...
    
  • Disable garbage collection on the cluster:

    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: config-gc
      namespace: knative-serving
    data:
      retain-since-create-time: "disabled"
      retain-since-last-active-time: "disabled"
      max-non-active-revisions: "disabled"
    ...
    

We use analytics and cookies to understand site traffic. Information about your use of our site is shared with Google for that purpose. Learn more.

× OK