Skip to content

Revisions

Revisions are Knative Serving resources that contain point-in-time snapshots of the application code and configuration for each change made to a Knative Service.

You cannot create Revisions or update a Revision spec directly; Revisions are always created in response to updates to a Configuration spec. However, you can force the deletion of Revisions, to handle leaked resources as well as for removal of known bad Revisions to avoid future errors when managing a Knative Service.

Revisions are generally immutable, except where they may reference mutable core Kubernetes resources such as ConfigMaps and Secrets. Revisions can also be mutated by changes in Revision defaults. Changes to defaults that mutate Revisions are generally syntactic and not semantic.

Revisions are immutable snapshots of your application code and configuration: updating a Service's spec.template creates a new Revision rather than modifying the existing Revision's spec. You can still update mutable metadata (such as the no-gc annotation below) on an existing Revision.

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 for 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.

Disabling garbage collection for a Revision

To prevent a specific Revision from being garbage collected, add the serving.knative.dev/no-gc: "true" annotation to its metadata:

kubectl annotate revision <revision-name> serving.knative.dev/no-gc="true"

Or in the Revision metadata:

apiVersion: serving.knative.dev/v1
kind: Revision
metadata:
  name: <revision-name>
  annotations:
    serving.knative.dev/no-gc: "true"

For cluster-wide garbage collection thresholds, see Configuring Revision garbage collection.

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.