Skip to content

Commit 502a190

Browse files
Merge pull request #17 from Graylog2/updates/docs
Add MicroK8s instructions to CONTRIBUTING.md
2 parents 575df56 + c0d6e15 commit 502a190

File tree

3 files changed

+136
-1
lines changed

3 files changed

+136
-1
lines changed

CONTRIBUTING.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,127 @@ git fetch origin
1818
git rebase origin/main
1919
```
2020
- All PRs must be reviewed by at least one maintainer before merging.
21+
22+
# Testing
23+
24+
- [Setting up a MicroK8s cluster](#setting-up-a-microk8s-cluster)
25+
- [Validating chart](#validating-chart)
26+
- [Installing Graylog](#installing-chart)
27+
- [Upgrading chart](#upgrading-chart)
28+
29+
## Setting up a MicroK8s cluster
30+
31+
This Helm chart should ideally work on any Kubernetes cluster.
32+
For local development and iterative testing, we recommend using MicroK8s.
33+
This setup enables a rapid development workflow without the need to manage complex infrastructure.
34+
35+
#### Back up your existing Kubernetes configuration
36+
37+
```bash
38+
[ -d $HOME/.kube ] && mv $HOME/.kube $HOME/.kube.old
39+
```
40+
41+
### Install MicroK8s
42+
43+
```bash
44+
microk8s install --cpu 8 --mem 24 --disk 200 --channel latest/stable
45+
```
46+
#### Configure access to your new MicroK8s Kubernetes cluster
47+
48+
```bash
49+
mkdir $HOME/.kube && microk8s config -o yaml > $HOME/.kube/config
50+
chmod 400 $HOME/.kube/config
51+
```
52+
53+
### Enable [DNS](https://microk8s.io/docs/addon-dns) and [local storage](https://microk8s.io/docs/addon-hostpath-storage) addons
54+
55+
```bash
56+
microk8s enable dns
57+
microk8s enable hostpath-storage
58+
```
59+
60+
### Enable MetalLB
61+
62+
You will need a valid IP address range on your network that MetalLB can use for LoadBalancer services.
63+
64+
#### Getting your CIDR
65+
66+
Depending on your OS, you might be running MicroK8s directly on Linux or inside a virtual machine on macOS.
67+
Below are example commands for each setup:
68+
69+
70+
<details>
71+
<summary>Get CIDR on Linux using the <code>eth0</code> interface</summary>
72+
<pre><code>CIDR=$(ip -4 -o addr show scope global | grep 'eth0' | awk '{print $4}' | sed 's|[0-9]\+/|0/|')</code></pre>
73+
</details>
74+
75+
<details>
76+
<summary>Get CIDR on macOS using the MicroK8s VM address</summary>
77+
<pre><code>CIDR=$(multipass info microk8s-vm --format json | jq -r '.info["microk8s-vm"].ipv4[0] + "/32"')</code></pre>
78+
</details>
79+
80+
You can verify that the CIDR was captured correctly with:
81+
82+
```bash
83+
echo $CIDR
84+
```
85+
86+
#### Enable MetalLB addon
87+
88+
Once you have your CIDR, you can enable metallb
89+
90+
```bash
91+
microk8s enable metallb:$CIDR
92+
```
93+
94+
> [!IMPORTANT]
95+
> If you are running **MicroK8s on macOS**, you will need to increase the memory map areas per VM process
96+
97+
```bash
98+
# only if running microk8s on macOS
99+
multipass exec microk8s-vm -- sudo sysctl -w vm.max_map_count=262144
100+
```
101+
102+
### Validating chart
103+
104+
```bash
105+
# check template rendering
106+
helm template graylog . --debug | less
107+
108+
# do a dry run with a small configuration
109+
helm install graylog . --dry-run --debug --create-namespace -n graylog --set quicksetup="small"
110+
111+
# do a dry run with the default configuration
112+
helm install graylog . --dry-run --debug --create-namespace -n graylog
113+
114+
```
115+
116+
### Installing chart
117+
118+
```bash
119+
helm install graylog . -n graylog --create-namespace -n graylog --set quicksetup="small" --set graylog.custom.service.type="LoadBalancer"
120+
```
121+
122+
### Upgrading chart
123+
124+
> [!NOTE]
125+
> Values can be passed into the chart from multiple sources, including
126+
> - The `values.yaml` file in the chart, with all default values
127+
> - A values file passed with the `--values` or `-f` flag (e.g. `helm upgrade graylog . -f mynewvals.yaml`)
128+
> - Individual parameters passed with `--set` (e.g. `helm upgrade graylog . --set foo=bar`)
129+
>
130+
> The default values in `values.yaml` can be overridden by a parent chart's `values.yaml` (in the event this chart is used as a subchart), which can in turn be overridden by a user-supplied values file with `-f`, which can in turn be overridden by `--set` parameters.
131+
132+
> [!NOTE]
133+
> The `reset-values` and `reuse-values` flags can be used to control how values are handled during an upgrade:
134+
> - `--reset-values`: Discards the previously set values and uses only the values provided in the current upgrade command (via `--values` or `--set`).
135+
> - `--reuse-values`: Reuses the values from the last release and merges them with any new values provided in the upgrade command.
136+
>
137+
> These two flags are mutually exclusive.
138+
>
139+
> In addition, if no `-f` (or `--values`), or `--set` (or `--set-string`, or `--set-file`) flags are applied,
140+
> `--reuse-values` will be used by default. Otherwise, `--reset-values` will be used by default.
141+
```bash
142+
# keeps previously set values and overrides current "version"
143+
helm upgrade graylog . -n graylog --reuse-values --set version="6.3"
144+
```

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,17 @@ git clone git@github.com:Graylog2/graylog-helm.git
3333
cd graylog-helm
3434
```
3535

36+
### Set default StorageClass
37+
***If your cluster already has a default `storageclass` you can skip this step.***
38+
39+
If not, you're unsure, or you don't want to affect cluster-wide settings, set the default `storageclass` for this Chart at runtime by passing `--set global.defaultStorageClass="my-sc"` to your `helm install` command. Or by adding the following lines to `values-custom.yaml`:
40+
```
41+
global:
42+
defaultStorageClass: "my-sc"
43+
```
44+
45+
Just be sure to pass `-f values-custom.yaml` to your `helm install` command below!
46+
3647
### Set Root Graylog Password
3748
```sh
3849
read -sp "Enter your new password and press return: " pass

graylog/templates/NOTES.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Welcome to Graylog!
4848

4949
· WARNING: You are still using the default password {{ include "graylog.rootPassword" . | quote }}. This MUST be changed IMMEDIATELY using the following command:
5050

51-
read -sp "Enter your new password and press return: " i && helm upgrade {{ .Release.Name }} graylog/graylog --namespace {{ .Release.Namespace }} --reuse-values --set "graylog.config.rootPassword=$i"
51+
read -sp "Enter your new password and press return: " i && helm upgrade {{ .Release.Name }} ./graylog --namespace {{ .Release.Namespace }} --reuse-values --set "graylog.config.rootPassword=$i"
5252
{{- end }}
5353

5454
· Use the following command to print this status page again:

0 commit comments

Comments
 (0)