NOTE: The container freezer functionality was removed from Knative Serving in v1.10, and this repo was archived in April 2023.
STATUS | Sponsoring WG |
---|---|
Deprecated | Serving |
A standalone service for Knative to pause/unpause containers when request count drops to zero.
NOTE It is highly recommended to disable aggressive probing on your application when using the container-freezer. This can be done by setting periodSeconds: 0
on your application's readiness probe. See here for an example.
In order to use the container-freezer, you will need a running installation of Knative Serving. Instructions for doing so can be found in the docs.
Note that your cluster will need to have the Service Account Token Volume Projection feature enabled. For details, see this link: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#service-account-token-volume-projection
Next, you will need to label your nodes with the runtime used in your cluster:
-
For containerd:
kubectl label nodes minikube knative.dev/container-runtime=containerd
-
For cri-o(version>=1.24.1):
kubectl label nodes minikube knative.dev/container-runtime=crio
RUNTIME=containerd
RELEASE=v0.1.0
kubectl apply -f "https://github.com/knative-sandbox/container-freezer/releases/download/${RELEASE}/freezer-common.yaml"
kubectl apply -f "https://github.com/knative-sandbox/container-freezer/releases/download/${RELEASE}/freezer-${RUNTIME}.yaml"
Note: RUNTIME
must be one of either containerd
or crio
.
Check the Releases page to get the most recent version.
By default, Knative does not enable the freezing capability. We can enable it by providing a value for concurrency-state-endpoint
in the Knative Serving deployment configmap:
data:
concurrency-state-endpoint: "http://$HOST_IP:9696"
Alternatively, you can also patch the configmap using kubectl
:
kubectl patch configmap/config-deployment -n knative-serving --type merge -p '{"data":{"concurrencyStateEndpoint":"http://$HOST_IP:9696"}}'
See the sleeptalker application.