STATUS | Sponsoring WG |
---|---|
Alpha | 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 docker:
kubectl label nodes minikube knative.dev/container-runtime=docker
To run the container-freezer service, the first step is to clone this repository:
git clone git@github.com:knative-sandbox/container-freezer.git
Next, use ko
to build and deploy the container-freezer service:
cd container-freezer
ko apply -f config/
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.