-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
547 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<!-- | ||
project: SimKube | ||
template: docs.html | ||
--> | ||
|
||
# Autoscaling with SimKube | ||
|
||
When running your simulations, you probably don't want to have to manually create a bunch of KWOK nodes every time. | ||
Fortunately, both [Cluster Autoscaler](https://github.com/kubernetes/autoscaler) and [Karpenter](https://karpenter.sh) | ||
(the two most popular cluster autoscalers for Kubernetes) support KWOK, which means you can have them autoscaler your | ||
simulated cluster so you don't have to manually create virtual nodes. | ||
|
||
## Cluster Autoscaler instructions | ||
|
||
You will need to run Cluster Autoscaler with the `--cloud-provider kwok` argument. The KWOK Cluster Autoscaler provider | ||
expects two ConfigMaps to be present; the first tells the KWOK cloudprovider what to use for its Cluster Autoscaler | ||
NodeGroups: | ||
|
||
```yaml | ||
# provider-config.yml | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: kwok-provider-config | ||
namespace: kube-system | ||
data: | ||
config: | | ||
--- | ||
apiVersion: v1alpha1 | ||
readNodesFrom: configmap | ||
nodegroups: | ||
fromNodeLabelKey: "kwok-nodegroup" | ||
configmap: | ||
name: kwok-provider-templates | ||
``` | ||
The second enumerates the node types that the KWOK cloudprovider supports: | ||
```yaml | ||
# provider-templates.yml | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: kwok-provider-templates | ||
namespace: kube-system | ||
data: | ||
templates: | | ||
--- | ||
apiVersion: v1 | ||
kind: List | ||
items: | ||
- apiVersion: v1 | ||
kind: Node | ||
metadata: | ||
annotations: | ||
kwok.x-k8s.io/node: fake | ||
kowk-nodegroup: node-group-1 | ||
labels: | ||
node.kubernetes.io/instance-type: c5d.9xlarge | ||
topology.kubernetes.io/zone: us-west-1a | ||
type: virtual | ||
status: | ||
allocatable: | ||
cpu: 31 | ||
ephemeral-storage: 900Gi | ||
memory: 71Gi | ||
pods: 110 | ||
capacity: | ||
cpu: 36 | ||
ephemeral-storage: 900Gi | ||
memory: 72Gi | ||
pods: 110 | ||
``` | ||
The KWOK cloudprovider will automatically apply a `kwok-provider: true` taint to the nodes it generates with a | ||
`NoSchedule` effect on them. SimKube will likewise apply the corresponding toleration to the virtual pods it creates. | ||
|
||
For more information on running and configuring KWOK for Cluster Autoscaler, see the | ||
[README](https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler/cloudprovider/kwok). | ||
|
||
## Karpenter instructions | ||
|
||
The core [karpenter repo](https://github.com/kubernetes-sigs/karpenter) includes a KWOK provider for karpenter. There | ||
are some initial instructions in there for installing the karpenter+KWOK binary into your cluster. Once it's installed, | ||
it will automatically use KWOK to scale up nodes in the cluster just like Cluster Autoscaler. As with Cluster | ||
Autoscaler, KWOK applies the `kwok-provider=true:NoSchedule` taint to the nodes it creates. | ||
|
||
> [!NOTE] | ||
> Unlike Cluster Autoscaler, karpenter does not take in a list of Kubernetes Node specs to determine what instances it | ||
> launches. Instead, it uses a hard-coded list of "generic" instance types which roughly map to standard instance | ||
> offerings by the major cloud providers. There is an [open PR](https://github.com/kubernetes-sigs/karpenter/pull/1048) | ||
> to enable configuring node types via an injected file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!-- | ||
project: SimKube | ||
template: docs.html | ||
--> | ||
|
||
# Metrics Collection and Data Analysis | ||
|
||
Coming Soon |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!-- | ||
project: SimKube | ||
template: docs.html | ||
--> | ||
|
||
# Frequently Asked Questions | ||
|
||
Coming Soon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!-- | ||
project: SimKube | ||
template: docs.html | ||
--> | ||
|
||
# SimKube Concepts | ||
|
||
SimKube is designed to allow users to simulate the behaviour of Kubernetes control plane components in a safe, isolated | ||
local environment. It is a "record-and-replay" simulator, which means that users can record the behaviour of a production | ||
cluster and then save that data for future analysis. Below we describe some of the key concepts of SimKube | ||
|
||
## What components are simulated? | ||
|
||
Typically when we talk about the Kubernetes control plane, we are talking about the API server, scheduler, and | ||
controller manager. SimKube expands this definition to include anything that can impact the behaviour of a cluster, | ||
including projects like Cluster Autoscaler, descheduler, and others. | ||
|
||
SimKube accomplishes this by running in a cluster with a real control plane; however, all pod behaviours are mocked out | ||
using [Kubernetes WithOut Kubelet (KWOK)](https://kwok.sigs.k8s.io). This means that anything that happens _inside_ a | ||
pod is effectively out of scope of the simulation. KWOK does have utilities to mock out some aspects of pod lifecycle, | ||
but these are not (currently) supported by SimKube. Crucially, this means that simulations that rely on the Horizontal | ||
Pod Autoscaler (for example) will not currently work. | ||
|
||
Note also that, unlike some simulation solutions, we are not mocking out any aspects of the control plane. This means | ||
that simulations of cluster behaviour take place in real-time, and we do not have any hooks into or control over what | ||
messages are seen by various control plane components. Thus, running the exact same simulation repeatedly may yield | ||
different results on each run, depending on timing fluctuations and other challenges of distributed systems. | ||
|
||
## How does it work? | ||
|
||
SimKube has a number of components that it uses to record data and run simulations: | ||
|
||
- _Tracer_: The `sk-tracer` program is a lightweight pod that runs in the cluster you wish to record the behaviour of. | ||
It saves cluster events into a in-memory event stream, that is, a timeline of "important" changes in the cluster. You | ||
can configure `sk-tracer` to tell it what events you consider important. Subsets of this event stream can be saved | ||
into a _trace file_, which can be replayed later in a simulated environment. | ||
- _Controller_: The simulation controller `sk-ctrl` runs in a separate Kubernetes cluster and is responsible for setting | ||
up simulations in that cluster. The separate cluster can be a local cluster running on your laptop using | ||
[kind](https://kind.sigs.k8s.io), or it can be a test cluster running in the cloud. The only requirement is that the | ||
simulation must have all the components present that you wish to simulate. The controller watches for `Simulation` | ||
custom resources to configure and start a new simulation run. It sets up metrics collection and other required tools, | ||
and then creates a simulation driver Job, which actually reads the specified trace file and replays the events within | ||
against the simulated cluster. | ||
- _CLI_: SimKube comes with an CLI utility called `skctl`, which can be used to export trace data from the cluster under | ||
study, as well as running new simulations in your simulated environment. |
Oops, something went wrong.