Merge pull request #27 from colin-mccarthy/master

modified K3s install section of Readme.md
This commit is contained in:
Carlos Eduardo 2020-03-02 17:21:28 -03:00 committed by GitHub
commit 683f536703
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,17 +37,20 @@ The ingresses can use TLS with the default self-signed certificate from your Ing
After changing these parameters, rebuild the manifests with `make`. After changing these parameters, rebuild the manifests with `make`.
## Quickstart ## Quickstart (non K3s)
The repository already provides a set of compiled manifests to be applied into the cluster. The deployment can be customized thru the jsonnet files. The repository already provides a set of compiled manifests to be applied into the cluster. The deployment can be customized thru the jsonnet files.
To simply deploy the stack, run: For the ingresses, edit `suffixDomain` to have your cluster URL suffix. This will be your ingresses will be exposed (ex. grafana.yourcluster.domain.com).
To deploy the stack, run:
```bash ```bash
$ make deploy $ make deploy
# Or manually: # Or manually:
$ make
$ kubectl apply -f manifests/ $ kubectl apply -f manifests/
# It can take a few seconds for the above 'create manifests' command to fully create the following resources, so verify the resources are ready before proceeding. # It can take a few seconds for the above 'create manifests' command to fully create the following resources, so verify the resources are ready before proceeding.
@ -59,33 +62,39 @@ $ kubectl apply -f manifests/ # This command sometimes may need to be done twice
If you get an error from applying the manifests, run the `make deploy` or `kubectl apply -f manifests/` again. Sometimes the resources required to apply the CRDs are not deployed yet. If you get an error from applying the manifests, run the `make deploy` or `kubectl apply -f manifests/` again. Sometimes the resources required to apply the CRDs are not deployed yet.
## Customizing for K3s ## Quickstart for K3s
To have your [K3s](https://github.com/rancher/k3s) cluster and the monitoring stack on it, follow the steps: To deploy the monitoring stack on your K3s cluster, there are four parameters that need to be configured in the `vars.jsonnet` file:
```bash
# Download K3s binary
wget https://github.com/rancher/k3s/releases/download/`curl -s https://api.github.com/repos/rancher/k3s/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")'`/k3s && chmod +x k3s
# Move to your path
sudo mv k3s /usr/local/bin
# Start K3s
sudo k3s server &
```
Now to deploy the monitoring stack on your K3s cluster, there are three parameters to be configured on `vars.jsonnet`:
1. Set `k3s.enabled` to `true`. 1. Set `k3s.enabled` to `true`.
2. Change your K3s master node IP(your VM or host IP) on `k3s.master_ip`. 2. Change your K3s master node IP(your VM or host IP) on `k3s.master_ip`.
3. Edit `suffixDomain` to have your node IP with the `.nip.io` suffix. This will be your ingress URL suffix. 3. Edit `suffixDomain` to have your node IP with the `.nip.io` suffix or your cluster URL. This will be your ingress URL suffix.
4. Set _traefikExporter_ `enabled` parameter to `true` to collect Traefik metrics and deploy dashboard. 4. Set _traefikExporter_ `enabled` parameter to `true` to collect Traefik metrics and deploy dashboard.
After changing these values, run `make` to build the manifests and `k3s kubectl apply -f manifests/` to apply the stack to your cluster. In case of errors on some resources, re-run the command. After changing these values to deploy the stack, run:
```bash
$ make deploy
# Or manually:
$ make
$ kubectl apply -f manifests/
# It can take a few seconds for the above 'create manifests' command to fully create the following resources, so verify the resources are ready before proceeding.
$ until kubectl get customresourcedefinitions servicemonitors.monitoring.coreos.com ; do date; sleep 1; echo ""; done
$ until kubectl get servicemonitors --all-namespaces ; do date; sleep 1; echo ""; done
$ kubectl apply -f manifests/ # This command sometimes may need to be done twice (to workaround a race condition).
```
If you get an error from applying the manifests, run the `make deploy` or `kubectl apply -f manifests/` again. Sometimes the resources required to apply the CRDs are not deployed yet.
## Ingress
Now you can open the applications: Now you can open the applications:
To list the created ingresses, run `k3s kubectl get ingress --all-namespaces`. To list the created ingresses, run `kubectl get ingress --all-namespaces`, if you added your cluster IP or URL suffix in `vars.jsonnet` before rebuilding the manifests, the applications will be exposed on:
* Grafana on [https://grafana.[your_node_ip].nip.io](https://grafana.[your_node_ip].nip.io), * Grafana on [https://grafana.[your_node_ip].nip.io](https://grafana.[your_node_ip].nip.io),
* Prometheus on [https://prometheus.[your_node_ip].nip.io](https://prometheus.[your_node_ip].nip.io) * Prometheus on [https://prometheus.[your_node_ip].nip.io](https://prometheus.[your_node_ip].nip.io)