Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add k6-operator docs to Set up #1559

Merged
merged 24 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
9eddaaf
chore: add basic structure for k6-operator docs
heitortsergent Apr 18, 2024
4ea406d
chore: hide reference for now
heitortsergent Apr 18, 2024
2f1015b
k6-operator: add main sections from the repo Readme.md
yorugac May 16, 2024
0731380
Add a short introduction to the index page
heitortsergent Jun 3, 2024
835339f
Update install-k6-operator.md
heitortsergent Jun 3, 2024
96b0ecf
Update upgrade-k6-operator.md
heitortsergent Jun 3, 2024
0bd07ec
Update troubleshooting.md
heitortsergent Jun 3, 2024
024875d
Update executing-k6-scripts-with-testrun-crd.md
heitortsergent Jun 3, 2024
fc15830
Update extensions.md
heitortsergent Jun 3, 2024
af61bb4
Update extensions.md
heitortsergent Jun 3, 2024
0bd92fb
Update common-options.md
heitortsergent Jun 3, 2024
66bd188
Update scheduling-tests.md
heitortsergent Jun 3, 2024
5c71c70
k6-operator: fix typos
yorugac Jun 14, 2024
8a7e311
k6-operator: add content for troubleshooting.md
yorugac Jun 14, 2024
9d046ed
chore: replaces instances of k6-operator with k6 Operator
heitortsergent Jul 1, 2024
b8b8104
chore: add uninstall instructions
heitortsergent Jul 1, 2024
1f999ad
chore: hide Upgrade k6 Operator page
heitortsergent Jul 1, 2024
c77a629
chore: add Use the k6 operator with Grafana Cloud k6 page
heitortsergent Jul 1, 2024
1d27807
chore: review troubleshooting doc
heitortsergent Jul 1, 2024
bc80292
chore: update Namespaced deployment heading to Watch namespace
heitortsergent Jul 1, 2024
c079328
Merge branch 'main' into chore/add-plz-docs
heitortsergent Jul 1, 2024
3f08b76
Apply suggestions from code review
heitortsergent Jul 19, 2024
ac060ef
Move docs to next and v0.52.x folders
heitortsergent Jul 19, 2024
6360694
Remove docs from v0.50.x folder
heitortsergent Jul 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docs/sources/v0.50.x/set-up/set-up-distributed-k6/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
weight: 150
title: Set up distributed k6
---

# Set up distributed k6

It's possible to run large load tests even when using a single node, or single machine. But, depending on your use case, you might also want to run a distributed Grafana k6 test in your own infrastructure.

A couple of reasons why you might want to do this:

- You run your application in Kubernetes and would like k6 to be executed in the same fashion as all your other infrastructure components.
- You want to run your tests within your private network for security and/or privacy reasons.

[k6 operator](https://github.com/grafana/k6-operator) is a Kubernetes operator that you can use to run distributed k6 tests in your cluster.

This section includes the following topics:

{{< section depth=2 >}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
---
weight: 100
title: Install k6-operator
---

# Install k6-operator

This guide provides step-by-step instructions on how to install k6 operator.

## Before you begin

To install k6 operator, you'll need:

- A Kubernetes cluster, along with access to it.
- [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl).

## Deploy the operator

There are three different options that you can use to deploy the k6-operator.

### Deploy with bundle

The easiest way to install the operator is with bundle:

```bash
curl https://raw.githubusercontent.com/grafana/k6-operator/main/bundle.yaml | kubectl apply -f -
```

Bundle includes default manifests for k6-operator, including a `k6-operator-system` namespace and k6-operator deployment with the latest tagged Docker image. Customizations can be made on top of this manifest as needed, for example, with `kustomize`.

### Deploy with Helm

Helm releases of k6-operator are published together with other Grafana Helm charts. You can install it with the following commands:

```bash
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update
helm install k6-operator grafana/k6-operator
```

You can also pass additional configuration options with a `values.yaml` file:

```bash
helm install k6-operator grafana/k6-operator -f values.yaml
```

Refer to the [k6-operator samples folder](https://github.com/grafana/k6-operator/blob/main/charts/k6-operator/samples/customAnnotationsAndLabels.yaml) for an example file.

You can find a complete list of Helm options in the [k6 operator charts folder](https://github.com/grafana/k6-operator/blob/main/charts/k6-operator/README.md).

### Deploy with Makefile

In order to install the operator with a Makefile, you'll need:

- [go](https://go.dev/doc/install)
- [kustomize](https://kubectl.docs.kubernetes.io/installation/kustomize/)

A more manual, low-level way to install the k6 operator is by running the command below:

```bash
make deploy
```

This method may be more useful for development of the k6-operator, depending on specifics of the setup.

## Install the CRD

The k6-operator includes custom resources called `TestRun`, `PrivateLoadZone`, and `K6`. They're automatically installed when you do a deployment or install a bundle, but you can also manually install them by running:

```bash
make install
```

{{< admonition type="warning" >}}

The `K6` CRD has been replaced by the `TestRun` CRD and will be deprecated in the future. We recommend using the `TestRun` CRD.

{{< /admonition >}}

## Deploy with custom namespace
yorugac marked this conversation as resolved.
Show resolved Hide resolved

By default, the k6-operator watches `TestRun` and `PriavteLoadZone` custom resources in all namespaces. You can also configure the k6-operator to watch a specific namespace by setting the `WATCH_NAMESPACE` environment variable for the operator's deployment:

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: k6-operator-controller-manager
namespace: k6-operator-system
spec:
template:
spec:
containers:
- name: manager
image: ghcr.io/grafana/k6-operator:controller-v0.0.14
env:
- name: WATCH_NAMESPACE
value: 'some-ns'
# ...
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
weight: 400
title: Troubleshooting
---

# Troubleshooting

heitortsergent marked this conversation as resolved.
Show resolved Hide resolved
<!-- TODO: Add content -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
weight: 200
title: Upgrade k6-operator
---

# Upgrade k6-operator

<!-- TODO: Add content -->
heitortsergent marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 10 additions & 0 deletions docs/sources/v0.50.x/set-up/set-up-distributed-k6/usage/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
weight: 300
title: Usage
---

# Usage

This section includes the following topics:

{{< section depth=2 >}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
weight: 300
title: Common options
---

# Common options

<!-- TODO: consider removing this page once full reference is generated -->

The only options that are required as part of the `TestRun` CRD spec are `script` and `parallelism`. This guide covers some of the most common options.

## Parallelism

`parallelism` defines how many instances of k6 runners you want to create. Each instance is assigned an equal execution segment. For instance, if your test script is configured to run 200 VUs and `parallelism` is set to 4, the k6-operator creates four k6 jobs, each running 50 VUs to achieve the desired VU count.

## Separate

`separate: true` indicates that the jobs created need to be distributed across different nodes. This is useful if you're running a
test with a really high VU count and want to make sure the resources of each node won't become a bottleneck.
heitortsergent marked this conversation as resolved.
Show resolved Hide resolved

## Service account

If you want to use a custom Service Account you'll need to pass it into both the starter and the runner object:

```yaml
apiVersion: k6.io/v1alpha1
kind: TestRun
metadata:
name: <test-name>
spec:
script:
configMap:
name: '<configmap>'
runner:
serviceAccountName: <service-account>
starter:
serviceAccountName: <service-account>
```

## Runner

Defines options for the test runner pods. The non-exhaustive list includes:

- Passing resource limits and requests.
- Passing in labels and annotations.
- Passing in affinity and anti-affinity.
- Passing in a custom image.

## Starter

Defines options for the starter pod. The non-exhaustive list includes:

- Passing in a custom image.
- Passing in labels and annotations.
heitortsergent marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading