In a previous article, I introduced FluxCD to bring GitOps approach to a project. This is quite interesting but mostly based on command-line interaction which can be painful for some users. Fortunately, weave company releases an open-source tool to easily plug a user-friendly UI to display your Flux information. This article will explain how to set it up and use it.
Install CLI
The official documentation is quite clear, but here are the main steps.
First, we need to install gitops
locally, here I'm using MacOS so I'm using homebrew
$ brew tap weaveworks/tap
$ brew install weaveworks/tap/gitops
# Check everything is fine
$ gitops version
/ Update
For a more generic way to install the CLI, you can use curl
$ curl --silent --location "https://github.com/weaveworks/weave-gitops/releases/download/v0.30.0/gitops-$(uname)-$(uname -m).tar.gz" | tar xz -C /tmp
$ sudo mv /tmp/gitops /usr/local/bin
Generate weave-gitops configuration
Now, we need to get the configuration for the dashboard to be installed.
$ PASSWORD="averyverystrongpassword"
$ gitops create dashboard ww-gitops \
--password=$PASSWORD \
--export > ./clusters/ovh-fluxcd/weave/weave-gitops-dashboard.yaml
⚠️ PASSWORD
is a demo one here. You can set up another one or better use an external secret manager
Here, I'm using the same repository as for my previous article: https://gitlab.com/fun_with/fun-with-k8s/fun-with-fluxcd
This command generates 2 components for Flux:
HelmRepository
describing where the helm chart is hostedHelmRelease
describes how to deploy the chart into the cluster
---
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
annotations:
metadata.weave.works/description: This is the source location for the Weave GitOps
Dashboard's helm chart.
labels:
app.kubernetes.io/component: ui
app.kubernetes.io/created-by: weave-gitops-cli
app.kubernetes.io/name: weave-gitops-dashboard
app.kubernetes.io/part-of: weave-gitops
name: ww-gitops
namespace: flux-system
spec:
interval: 1h0m0s
type: oci
url: oci://ghcr.io/weaveworks/charts
---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
annotations:
metadata.weave.works/description: This is the Weave GitOps Dashboard. It provides
a simple way to get insights into your GitOps workloads.
name: ww-gitops
namespace: flux-system
spec:
chart:
spec:
chart: weave-gitops
sourceRef:
kind: HelmRepository
name: ww-gitops
interval: 1h0m0s
values:
WEAVE_GITOPS_FEATURE_TELEMETRY: "true"
adminUser:
create: true
passwordHash: $2a$10$t/wk8MIWCYp.HBRE68T8FO5UVxTqtZM55BD4XfntO74WuMQAiqJYm
username: admin
⚠️ Beware, in 0.30.0 of weave-gitops
, the generated file is failing with Flux v2 because the apiversion
of the HelmRepository
is in v1
and should be in v1beta2
as in the example above. This bug will be fixed in 0.31.0
Now, we commit the file to our repository. A few times after, we can see in the helm-controller
component logs that it has been detected and that weave-gitops
is installed
$ kubectl logs -f helm-controller-7f8449fd58-bzsnl -n flux-system
[...]
{"level":"info","ts":"2023-08-21T17:01:09.861Z","msg":"HelmChart 'flux-system/flux-system-ww-gitops' is not ready","controller":"helmrelease","controllerGroup":"helm.toolkit.fluxcd.io","controllerKind":"HelmRelease","HelmRelease":{"name":"ww-gitops","namespace":"flux-system"},"namespace":"flux-system","name":"ww-gitops","reconcileID":"e812c347-8d36-4822-b16a-6770661ee06e"}
{"level":"info","ts":"2023-08-21T17:01:09.897Z","msg":"reconcilation finished in 129.917342ms, next run in 1h0m0s","controller":"helmrelease","controllerGroup":"helm.toolkit.fluxcd.io","controllerKind":"HelmRelease","HelmRelease":{"name":"ww-gitops","namespace":"flux-system"},"namespace":"flux-system","name":"ww-gitops","reconcileID":"e812c347-8d36-4822-b16a-6770661ee06e"}
[...]
$ kubectl get po -n fluw-system
NAME READY STATUS RESTARTS AGE
helm-controller-7f8449fd58-bzsnl 1/1 Running 0 4d22h
kustomize-controller-6f666f899b-wrshg 1/1 Running 0 4d22h
notification-controller-55bcdc9fcf-8ffkh 1/1 Running 0 4d22h
source-controller-b5f58d88d-4hzz7 1/1 Running 0 4d22h
ww-gitops-weave-gitops-7cf4bb77f7-7xhlx 1/1 Running 0 18h
Access the dashboard
If we have a look at the components deployed by weave-gitops
, we can see that there's a service exposing a port to access the dashboard. We can use port-forward
command to make it accessible locally
$ kubectl get svc -n flux-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
notification-controller ClusterIP 10.3.112.238 <none> 80/TCP 4d22h
source-controller ClusterIP 10.3.74.168 <none> 80/TCP 4d22h
webhook-receiver ClusterIP 10.3.168.89 <none> 80/TCP 4d22h
ww-gitops-weave-gitops ClusterIP 10.3.133.2 <none> 9001/TCP 18h
$ kubectl port-forward svc/ww-gitops-weave-gitops -n flux-system 9001:9001
Forwarding from 127.0.0.1:9001 -> 9001
Forwarding from [::1]:9001 -> 9001
We can now access the dashboard in a browser and use admin
and our super password to log in
Discovering the dashboard
Let's have a look at the information available on the dashboard
Applications listing all components managed with Flux
For each application, we have access to
Details of all components included in the application
-
Events that happened on the application
Graph showing component links
Dependencies with other applications
A
yaml
description of the application that can be exportedPotential violations (not yet tried on my side)
Sources displaying all different kinds of sources synchronized with Flux
For each source, we have access to
Details regarding the configuration
Events that occurred on it
A
yaml
definition of it that can be exported
Flux Runtime summarizes the current version of different components of Flux
Notifications & Image automation (but haven't tried it yet)
Conclusion
weave-gitops
is a very convenient way to display easily information regarding Flux usage in a cluster. We can easily retrieve information, start and stop synchronization of applications.
To go further, it could be nice to also declare new applications, sources, ... directly within the UI but it could be in a future release as the support team is quite reactive. For instance, I discovered a bug with Flux v2 version. I posted an issue on GitHub repository and it was fixed by the next day 👍
🙏 As usual thanks to OVHcloud to support me for this article by providing me with environments on their platform to test and illustrate.
At the time of this article, weave-gitops
was in version 0.31.0