Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Commit

Permalink
Improve tutorial steps (#35)
Browse files Browse the repository at this point in the history
Co-authored-by: Michel Loiseleur <[email protected]>
  • Loading branch information
immanuelfodor and mloiseleur authored Jan 12, 2024
1 parent 97685bc commit d2eeab9
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/traefik-hub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ jobs:
run: |
set -u
echo "# Traefik Hub Report:" > header.md
echo "# Traefik Hub Report" > header.md
echo "" >> header.md
echo "The following changes have been detected." >> header.md
echo "The following changes have been detected:" >> header.md
echo "" >> header.md
- name: Write report
Expand Down
36 changes: 31 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ If you'd like to follow along with this tutorial on your own machine, you'll nee
3. [Flux CD](https://fluxcd.io/flux/cmd/) command-line tool installed.
4. A Kubernetes cluster running.

In this tutorial, you'll use [kind](https://kind.sigs.k8s.io). You may also use alternatives like [k3d](https://k3d.io/), cloud providers or others.
In this tutorial, you'll use [kind](https://kind.sigs.k8s.io). You may also use alternatives like [k3d](https://k3d.io/), cloud providers, or others.

kind requires some configuration to use an IngressController on localhost, see the following example:

Expand Down Expand Up @@ -89,7 +89,7 @@ kubectl apply -f clusters/kind/metallb-config.yaml
**Using k3d**

```shell
k3d cluster create traefik-hub-gitops --port 80:80@loadbalancer --port 443:443@loadbalancer --port 8000:8000@loadbalancer --k3s-arg "--disable=traefik@server:0"
k3d cluster create traefik-hub-gitops --port 80:80@loadbalancer --port 443:443@loadbalancer --port 8000:8000@loadbalancer --k3s-arg "--disable=traefik@server:0"
```

# Fork the repo and deploy Flux CD
Expand Down Expand Up @@ -209,10 +209,36 @@ Prometheus is on http://prometheus.docker.localhost

Default credentials are login: admin and password: admin.

By clicking on the left menu, you are able to access to all dashboards:
By clicking on the left menu, you can access all dashboards:

![Grafana Dashboards](./images/grafana-dashboards.png)

## Enable event correlation

**Flux events**: Add a new Grafana service account with a new key at http://grafana.docker.localhost/org/serviceaccounts
and add the token (starting with `glsa_`) to the `apps/base/monitoring/flux-grafana.yaml` file.

```shell
export GRAFANA_TOKEN="xxx"
sed -i -e "s/token:\(.*\)/token: \""${GRAFANA_TOKEN}"\"/g" apps/base/monitoring/flux-grafana.yaml
```

Now, Flux can create annotations of reconciliation events in the dashboards.

**GitHub PR merges**: Add a new Grafana connection (GitHub data source) at http://grafana.docker.localhost/connections/datasources/grafana-github-datasource
You must add a Personal Access Token (PAT) to GitHub at https://github.com/settings/tokens/new, as explained in the Grafana connection creation wizard.
When configured, edit the dashboards to add new annotations using the GitHub data source:
- Show in: All panels
- Query type: Pull Requests
- Owner / Repository: your user and the repo name of the fork
- Query: leave it empty
- Time Field: MergedAt
- Annotations:
- Time field: `merged_at (time)`
- Title: `title (string)`
- Text: `url (string)`
- End time + tags + id: leave them empty

# Clean up

Everything is installed in Kubernetes.
Expand All @@ -225,10 +251,10 @@ kind delete cluster --name traefik-hub-gitops

```shell
# k3d
k3D delete cluster traefik-hub-gitops
k3d delete cluster traefik-hub-gitops
```

You may also want to delete agent in Traefik Hub UI.
You may also want to delete the agent in Traefik Hub UI.

## License

Expand Down
2 changes: 1 addition & 1 deletion apps/base/apps/api-portal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ spec:
description: "API Portal"
apiGateway: api-gateway
ui:
logoUrl: https://camo.githubusercontent.com/7b6d7326498561d3ef4aa9916b82bf927767fc18890f610aa522c018fed8715d/68747470733a2f2f646f632e7472616566696b2e696f2f7472616566696b2d6875622f6173736574732f696d672f7472616566696b2d6875622d6c6f676f2e737667
logoUrl: https://doc.traefik.io/traefik-hub/assets/img/traefik-hub-logo.svg
customDomains: []
2 changes: 1 addition & 1 deletion apps/base/apps/employee/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ spec:
number: 3000
name: employee-app
port:
number: 3000
number: 3000
4 changes: 2 additions & 2 deletions apps/base/monitoring/flux-grafana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
eventSeverity: info
eventSources:
- kind: Kustomization
name: 'kubecon-apps'
name: 'apps'
namespace: flux-system
---
apiVersion: notification.toolkit.fluxcd.io/v1beta2
Expand All @@ -30,4 +30,4 @@ metadata:
name: grafana-auth
namespace: monitoring
stringData:
token: "glsa_Q5Ebm9dBrFekrw3SNHz8imVJLByhAqhb_b5d1511e"
token: "see README.md"
2 changes: 1 addition & 1 deletion apps/base/traefik-hub/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
chart:
spec:
chart: traefik-hub
version: v2.7.0
version: v3.0.0
sourceRef:
kind: HelmRepository
name: traefik-hub
Expand Down

0 comments on commit d2eeab9

Please sign in to comment.