Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wzshiming committed Apr 20, 2023
1 parent 1dcfb0e commit 57f8c3a
Show file tree
Hide file tree
Showing 16 changed files with 96 additions and 62 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ Please see [our website] for more in-depth information.

## Why KWOK?

- Lightweight: You can [simulate thousands of nodes](https://kwok.sigs.k8s.io/docs/user/kwok-manage-nodes-and-pods/) on your laptop without significant consumption of CPU or memory resources.
Currently, KWOK can reliably maintain 1k nodes and 100k pods.
- Lightweight: You can [simulate thousands of nodes] on your laptop without significant consumption of CPU or memory resources.
Currently, KWOK can reliably maintain 1k nodes and 100k pods easily.
- Fast: You can create and delete clusters and nodes almost instantly, without waiting for boot or provisioning.
Currently, KWOK can create 20 nodes or pods per second.
- Compatibility: KWOK works with any tools or clients that are compliant with Kubernetes APIs, such as kubectl, helm, kui, etc.
- Portability: KWOK has no specific hardware or software requirements. You can [run it using pre-built images](https://kwok.sigs.k8s.io/docs/user/all-in-one-image/), once Docker or Nerdctl is installed. Alternatively, binaries are also available for all platforms and can be easily installed.
- Portability: KWOK has no specific hardware or software requirements. You can [run it using pre-built images], once Docker or Nerdctl is installed. Alternatively, binaries are also available for all platforms and can be easily installed.
- Flexibility: You can configure different node types, labels, taints, capacities, conditions, etc., and you can configure different pod behaviors, status, etc. to test different scenarios and edge cases.

## Community
Expand All @@ -53,3 +53,5 @@ Participation in the Kubernetes community is governed by the [Kubernetes Code of
[#kwok]: https://kubernetes.slack.com/messages/kwok/
[#kwok-dev]: https://kubernetes.slack.com/messages/kwok-dev/
[slack.k8s.io]: https://slack.k8s.io/
[simulate thousands of nodes]: https://kwok.sigs.k8s.io/docs/user/kwok-manage-nodes-and-pods/
[run it using pre-built images]: https://kwok.sigs.k8s.io/docs/user/all-in-one-image/
8 changes: 5 additions & 3 deletions site/content/en/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ KWOK stands for Kubernetes WithOut Kubelet. So far, it provides two tools:

## Why KWOK?

- Lightweight: You can [simulate thousands of nodes]({{< relref "/docs/user/kwok-manage-nodes-and-pods" >}}) on your laptop without significant consumption of CPU or memory resources.
Currently, KWOK can reliably maintain 1k nodes and 100k pods.
- Lightweight: You can [simulate thousands of nodes] on your laptop without significant consumption of CPU or memory resources.
Currently, KWOK can reliably maintain 1k nodes and 100k pods easily.
- Fast: You can create and delete clusters and nodes almost instantly, without waiting for boot or provisioning.
Currently, KWOK can create 20 nodes or pods per second.
- Compatibility: KWOK works with any tools or clients that are compliant with Kubernetes APIs, such as kubectl, helm, kui, etc.
- Portability: KWOK has no specific hardware or software requirements. You can [run it using pre-built images]({{< relref "/docs/user/all-in-one-image" >}}), once Docker or Nerdctl is installed. Alternatively, binaries are also available for all platforms and can be easily installed.
- Portability: KWOK has no specific hardware or software requirements. You can [run it using pre-built images], once Docker or Nerdctl is installed. Alternatively, binaries are also available for all platforms and can be easily installed.
- Flexibility: You can configure different node types, labels, taints, capacities, conditions, etc., and you can configure different pod behaviors, status, etc. to test different scenarios and edge cases.

## Getting Started
Expand Down Expand Up @@ -78,3 +78,5 @@ Participation in the Kubernetes community is governed by the [Kubernetes Code of
[#kwok]: https://kubernetes.slack.com/messages/kwok/
[#kwok-dev]: https://kubernetes.slack.com/messages/kwok-dev/
[slack.k8s.io]: https://slack.k8s.io/
[run it using pre-built images]: {{< relref "/docs/user/all-in-one-image" >}}
[simulate thousands of nodes]: {{< relref "/docs/user/kwok-manage-nodes-and-pods" >}}
10 changes: 4 additions & 6 deletions site/content/en/docs/adopters/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ We are frequently asked who is using of KWOK and how. We would like to share the

Sharing experiences and learning from other users is essential.

{{< details "please consider adding yourself to the list of adopters" >}}

Follow the example below to add.
Please consider adding yourself to the list of adopters, follow the example below to add.

```yaml
# kwok.yaml
Expand All @@ -19,10 +17,10 @@ links:
url: https://kwok.sigs.k8s.io # your link url
```
Create a pull request to [add yourself](https://github.com/kubernetes-sigs/kwok/new/main/site/assets/adopters/).
{{< /details >}}
Create a pull request to [add yourself].
## List of adopters
{{< adopters >}}
[add yourself]: https://github.com/kubernetes-sigs/kwok/new/main/site/assets/adopters/
25 changes: 12 additions & 13 deletions site/content/en/docs/user/all-in-one-image.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,25 @@ This document walks through the steps to create a cluster with the all-in-one im
## Getting started

``` bash
docker run --rm -it -p 8080:8080 registry.k8s.io/kwok/cluster:v1.26.0
docker run --rm -it -p 8080:8080 registry.k8s.io/kwok/cluster:v0.2.0-k8s.v1.27.1
```

``` log
Creating cluster cluster=kwok
Starting cluster cluster=kwok
Cluster is created cluster=kwok elapsed=1s
Cluster is creating cluster=kwok
Cluster is created cluster=kwok elapsed=0s
Cluster is starting cluster=kwok
Cluster is started cluster=kwok elapsed=2s
You can now use your cluster with:
kubectl config use-context kwok-kwok
kubectl cluster-info --context kwok-kwok
Thanks for using kwok!
###############################################################################
> kubectl -s :8080 version
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short. Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:"1", Minor:"26", GitVersion:"v1.26.0", GitCommit:"b46a3f887ca979b1a5d14fd39cb1af43e7e5d12d", GitTreeState:"clean", BuildDate:"2022-12-08T19:58:30Z", GoVersion:"go1.19.4", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v4.5.7
Server Version: version.Info{Major:"1", Minor:"26", GitVersion:"v1.26.0", GitCommit:"b46a3f887ca979b1a5d14fd39cb1af43e7e5d12d", GitTreeState:"clean", BuildDate:"2022-12-08T19:51:45Z", GoVersion:"go1.19.4", Compiler:"gc", Platform:"linux/amd64"}
Client Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.1", GitCommit:"4c9411232e10168d7b050c49a1b59f6df9d7ea4b", GitTreeState:"clean", BuildDate:"2023-04-14T13:21:19Z", GoVersion:"go1.20.3", Compiler:"gc", Platform:"linux/arm64"}
Kustomize Version: v5.0.1
Server Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.1", GitCommit:"4c9411232e10168d7b050c49a1b59f6df9d7ea4b", GitTreeState:"clean", BuildDate:"2023-04-14T13:14:42Z", GoVersion:"go1.20.3", Compiler:"gc", Platform:"linux/arm64"}
###############################################################################
# The following kubeconfig can be used to connect to the Kubernetes API server
apiVersion: v1
Expand All @@ -44,11 +45,9 @@ preferences: {}
users: null
###############################################################################
> kubectl -s :8080 get ns
NAME STATUS AGE
default Active 0s
kube-node-lease Active 1s
kube-public Active 1s
kube-system Active 1s
NAME STATUS AGE
default Active 0s
kube-system Active 1s
###############################################################################
# The above example works if your host's port is the same as the container's,
# otherwise, change it to your host's port
Expand Down
5 changes: 3 additions & 2 deletions site/content/en/docs/user/attach-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This document walks you through how to configure the Attach feature.

## What is a Attach?

The Attach API is a [`kwok` Configuration]({{< relref "/docs/user/configuration" >}}) that allows users to define and simulate attaching to Pod(s).
The Attach API is a [`kwok` Configuration][configuration] that allows users to define and simulate attaching to Pod(s).

A Attach resource has the following fields:

Expand Down Expand Up @@ -48,7 +48,6 @@ spec:
- <string>
matchNames:
- <string>
attaches:
- containers:
- <string>
Expand All @@ -62,3 +61,5 @@ The `matchNames` field specifies the names to be matched. If the `matchNames` fi
## Examples

<img width="700px" src="/img/demo/attach.svg">

[configuration]: {{< relref "/docs/user/configuration" >}}
18 changes: 11 additions & 7 deletions site/content/en/docs/user/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,38 @@ This document walks you through how to configure `kwok`/`kwokctl` options.

## Getting Started

To configure, you will need to create a [YAML](https://yaml.org/) configuration file.
To configure, you will need to create a [YAML] configuration file.
This file follows Kubernetes conventions for versioning etc.

A minimal valid config file looks like this:

``` yaml
kind: KwokConfiguration
apiVersion: kwok.x-k8s.io/v1alpha1
apiVersion: config.kwok.x-k8s.io/v1alpha1
options:
---
kind: KwokctlConfiguration
apiVersion: kwok.x-k8s.io/v1alpha1
apiVersion: config.kwok.x-k8s.io/v1alpha1
options:
```
This config specifies that we are configuring `kwok`/`kwokctl` and that the version of the config we are using is `v1alpha1` (`apiVersion: kwok.x-k8s.io/v1alpha1`).
This config specifies that we are configuring `kwok`/`kwokctl` and that the version of the config we are using is `v1alpha1` (`apiVersion: config.kwok.x-k8s.io/v1alpha1`).

Different versions may support different options and behaviors, which is why we must always specify the version. This mechanism is inspired by Kubernetes resources and component config.

To use this config, place the contents in a file `~/.kwok/kwok.yaml` or run the command with `--config=kwok.yaml` from the same directory.

The structure of the Configuration type is defined by a Go struct, which is described [here](https://pkg.go.dev/sigs.k8s.io/kwok/pkg/apis/v1alpha1).
The structure of the Configuration type is defined by a Go struct, which is described [here][api-config-v1alpha1].

## A Note on CLI Flags, Environment Variables, and Configuration Files

Uses the following precedence order. Each item takes precedence over the item below it:

1. flags specified on the command line
2. environment variables (with the prefix `KWOK_`)
3. values specified in the configuration file (`--config=` or `~/.kwok/kwok.yaml`)
4. default values
3. values specified in the configuration file `--config=`
4. basic configuration file `~/.kwok/kwok.yaml`
5. default values

## Using `kwok`

Expand All @@ -47,3 +48,6 @@ When using `kwok`, it takes its configuration from the configuration file and ig
## Using `kwokctl`

When using `kwokctl`, it takes its configuration from the configuration file and passes the configuration file to `kwok`.

[api-config-v1alpha1]: https://pkg.go.dev/sigs.k8s.io/kwok/pkg/apis/config/v1alpha1
[YAML]: https://yaml.org/
5 changes: 3 additions & 2 deletions site/content/en/docs/user/exec-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This document walks you through how to configure the Exec feature.

## What is a Exec?

The Exec API is a [`kwok` Configuration]({{< relref "/docs/user/configuration" >}}) that allows users to define and simulate exec to Pod(s).
The Exec API is a [`kwok` Configuration][configuration] that allows users to define and simulate exec to Pod(s).

A Exec resource has the following fields:

Expand Down Expand Up @@ -52,7 +52,6 @@ spec:
- <string>
matchNames:
- <string>
execs:
- containers:
- <string>
Expand All @@ -70,3 +69,5 @@ The `matchNames` field specifies the names to be matched. If the `matchNames` fi
## Examples

<img width="700px" src="/img/demo/exec.svg">

[configuration]: {{< relref "/docs/user/configuration" >}}
15 changes: 7 additions & 8 deletions site/content/en/docs/user/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@ This document walks you through how you can get started with KWOK easily.

{{< /hint >}}

Getting started with an open project like KWOK can be a great way to learn more
about Kubernetes. Here are some tips to help you get started.

## Installation

- [Install with Homebrew]({{< relref "/docs/user/install#homebrew" >}}) - Applicable to your local Linux/MacOS
- [Install binary releases]({{< relref "/docs/user/install#binary-releases" >}})
Getting started with an open project like KWOK can be a great way to learn more about Kubernetes.
Here are some tips to help you get started.

## Basic Usage

Expand All @@ -31,5 +26,9 @@ If any special concerns, you can configure KWOK with options and stages.

- [Options]({{< relref "/docs/user/configuration" >}})
- [Stages]({{< relref "/docs/user/stages-configuration" >}})
- [PortForward]({{< relref "/docs/user/port-forward-configuration" >}})
- [Exec]({{< relref "/docs/user/exec-configuration" >}})
- [Logs]({{< relref "/docs/user/logs-configuration" >}})
- [Attach]({{< relref "/docs/user/attach-configuration" >}})

I hope this helps you get started with KWOK! Good luck and have fun contributing to the project!
I hope this helps you get started with KWOK! Good luck and have fun!
14 changes: 14 additions & 0 deletions site/content/en/docs/user/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,24 @@ This document walks through the installation of `kwokctl` and `kwok` binaries.

On Linux/MacOS systems you can install kwok/kwokctl via [brew](https://formulae.brew.sh/formula/kwok):

this will install the latest version of `kwokctl` and `kwok` binaries.

``` bash
brew install kwok
```

## Go Install

also, you can install `kwokctl` and `kwok` binaries via [golang].

``` bash
go install sigs.k8s.io/kwok/cmd/{kwok,kwokctl}@latest
```

## Binary Releases

Or download from github releases page:

### Variables preparation

``` bash
Expand All @@ -40,3 +52,5 @@ wget -O kwok -c "https://github.com/${KWOK_REPO}/releases/download/${KWOK_LATEST
chmod +x kwok
sudo mv kwok /usr/local/bin/kwok
```

[golang]: https://golang.org/doc/install
5 changes: 5 additions & 0 deletions site/content/en/docs/user/kwok-out-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ This document walks you through how to run `kwok` out of cluster for a Kubernete

Firstly, you need to have a Kubernetes cluster, and the `kwok` command-line tool must be available in your `PATH`.

## Install `kwok`

[Install `kwok`][install] in your environment.

## Running

Next, you can run `kwok` out of cluster by using the `--kubeconfig` flag.
Expand All @@ -38,3 +42,4 @@ Finally, you can see the `kwok` is running out of cluster for the Kubernetes clu
Now, you can use `kwok` to [manage nodes and pods] in the Kubernetes cluster.

[manage nodes and pods]: {{< relref "/docs/user/kwok-manage-nodes-and-pods" >}}
[install]: {{< relref "/docs/user/install" >}}
3 changes: 2 additions & 1 deletion site/content/en/docs/user/kwokctl-manage-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This document walks you through how to run `kwokctl` to manage fake clusters.

## Install `kwokctl`

[Install `kwokctl`]({{< relref "/docs/user/install" >}}) in your environment.
[Install `kwokctl`][install] in your environment.

## Create a Cluster

Expand Down Expand Up @@ -58,3 +58,4 @@ Cluster "kwok-kwok" deleted
Now, you can use `kwok` to [manage nodes and pods] in the Kubernetes cluster.

[manage nodes and pods]: {{< relref "/docs/user/kwok-manage-nodes-and-pods" >}}
[install]: {{< relref "/docs/user/install" >}}
2 changes: 1 addition & 1 deletion site/content/en/docs/user/kwokctl-snapshot.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Save/Restore a Cluster with `kwokctl`
# `kwokctl` Snapshot

{{< hint "info" >}}

Expand Down
5 changes: 3 additions & 2 deletions site/content/en/docs/user/logs-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This document walks you through how to configure the Logs feature.

## What is a Logs?

The Logs API is a [`kwok` Configuration]({{< relref "/docs/user/configuration" >}}) that allows users to define and simulate logs to Pod(s).
The Logs API is a [`kwok` Configuration][configuration] that allows users to define and simulate logs to Pod(s).

A Logs resource has the following fields:

Expand Down Expand Up @@ -48,7 +48,6 @@ spec:
- <string>
matchNames:
- <string>
logs:
- containers:
- <string>
Expand All @@ -63,3 +62,5 @@ The `matchNames` field specifies the names to be matched. If the `matchNames` fi
## Examples

<img width="700px" src="/img/demo/logs.svg">

[configuration]: {{< relref "/docs/user/configuration" >}}
7 changes: 3 additions & 4 deletions site/content/en/docs/user/port-forward-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This document walks you through how to configure the PortForward feature.

## What is a PortForward?

The PortForward API is a [`kwok` Configuration]({{< relref "/docs/user/configuration" >}}) that allows users to define and simulate port forwarding to Pod(s).
The PortForward API is a [`kwok` Configuration][configuration] that allows users to define and simulate port forwarding to Pod(s).

A PortForward resource has the following fields:

Expand All @@ -25,7 +25,6 @@ spec:
target:
port: <int>
address: <string>

- ports:
- <int>
command:
Expand Down Expand Up @@ -56,14 +55,12 @@ spec:
- <string>
matchNames:
- <string>
forwards:
- ports:
- <int>
target:
port: <int>
address: <string>
- ports:
- <int>
command:
Expand All @@ -78,3 +75,5 @@ The `matchNames` field is used to match the name of the Pods. If the `matchNames
## Examples

<img width="700px" src="/img/demo/port-forward.svg">

[configuration]: {{< relref "/docs/user/configuration" >}}
Loading

0 comments on commit 57f8c3a

Please sign in to comment.