Deploy kwok in a Cluster
#
This document walks you through how to deploy kwok in a Kubernetes cluster.Helm Chart Installation #
The kwok helm chart is listed on the artifact hub.
YAML Installation #
You can also install kwok using the provided YAML manifests.
Variables preparation #
# KWOK repository
KWOK_REPO=kubernetes-sigs/kwok
# Get latest
KWOK_LATEST_RELEASE=$(curl "https://api.github.com/repos/${KWOK_REPO}/releases/latest" | jq -r '.tag_name')
Deploy kwok and set up custom resource definitions (CRDs) #
kubectl apply -f "https://github.com/${KWOK_REPO}/releases/download/${KWOK_LATEST_RELEASE}/kwok.yaml"
Set up default custom resources (CRs) of stages (required) #
NOTE: This step is required to configure the pod/node simulation behavior.
The default simulation behavior is defined in fast stage for pod and fast stage for node. They are suitable for scenarios such as scheduling and autoscaling. You can customize the simulation behavior with your own configuration file.
kubectl apply -f "https://github.com/${KWOK_REPO}/releases/download/${KWOK_LATEST_RELEASE}/stage-fast.yaml"
Set up default custom resources (CRs) of resource usage (optional) #
This allows to simulate the resource usage of nodes, pods and containers.
kubectl apply -f "https://github.com/${KWOK_REPO}/releases/download/${KWOK_LATEST_RELEASE}/metrics-usage.yaml"
The above configuration sets the CPU and memory usage of all the containers managed by kwok to 1m and to 1Mi respectively.
To override the defaults, you can add annotation "kwok.x-k8s.io/usage-cpu" (for cpu usage) and
"kwok.x-k8s.io/usage-memory" (for memory usage) with any quantity value you want to the fake pods.
The resource usage simulation used above is annotation-based and the configuration is available at here. For the explanation of how it works and more complex resource usage simulation methods, please refer to ResourceUsage configuration.
Next steps #
Now, you can use kwok to
manage nodes and pods in the Kubernetes cluster.