[Workshop] Learn how to integrate your charm with COS-Lite all the way
Summary on what we talked about on the workshop
This is a summary of what we talked about on the workshop Learn how to integrate your charm with COS-lite all the way
How to setup a COS-lite environment and start tinkering with it
Notice that this is an example setup to be able to start tinkering with COS-lite
Creating a bridge for COS-lite
We started of by creating a bridge in netplan to separate the network for COS-lite.
Edit /etc/netplan/network-configuration-file.yaml
|
|
Install microk8s cloud
After that we continued with installing microk8s from snap
Commands used in video
Metallb is a load balancer and your gateway in to traefik. Traefik then points to services inside kubernetes. There is 3 ways to set IP-addresses, examples: 1. Static-IP: 192.168.0.3/32, 2. Subnet: 192.168.0.0/24, 3. IP-range: 192.168.0.10-192.168.0.20
|
|
Bootstrap a controller on microk8s cloud
Next, we bootstrapp a juju controller on the microk8s cloud
Commands used in video
|
|
If you instead want to add the microk8s cloud to an already deployed controller use this commnads:
|
|
Deploy COS-lite
After bootstrapping a new controller, we add a new model for COS-lite and then deploying COS stack inside that.
Commands used in video
|
|
To deploy COS-lite using overlays (pre-defined configurations), we can add --overlay
to the command when deploying. Here are some overlay examples
Commands used in video
|
|
Connect to COS-lite services
Traefik is a reverse proxy, it get a gateway address from the metallb, which we can use to connect to grafana, prometheus and alertmanager. We can connect to the services by using the IP-address followed by model-name and application-name like this https://10.10.88.2/cos-grafana
. I’ve noticed that some applications require adding unit number as well (ex. cos-prometheus-0
).
Login to grafana
We can use actions to get the admin password to be able to login to grafana.
juju run-action grafana/0 get-admin-password --wait
Make offers needed for grafana-agent
After having COS-lite deployed and ready, we can make offers of the endpoints needed for grafana-agent. Grafana-agent needs to be related to 3 endpoints to get out of it’s blocked state.
Commands used in video
|
|
Build and deploy Observed charm
Observed is built by @eriklonroth as a reference charm to learn what COS-lite can do. It ships with a dashboard, prometheus & loki alert rule. To be able to build it you need a clone of the repo and charmcraft. After building it we can deploy observed to a new model.
Commands used in video
|
|
Deploy and integrate grafana-agent
For observed to be able to send data to the COS-lite, we need to deploy are “bridge” between COS-lite and the charms. Grafana-agent is a subordinate charm that scrapes metrics, logs and dashboards and sends it to COS stack. Charms need to support grafana-agent integrations for it to work, which observed does, so lets deploy and relate grafana-agent right now.
Commmands used in video
|
|
Consuming and relating offers
We can now see that grafana-agent is deployed under observed but is showing a blocked status. To get out of the blocked status we need to consume the offers we made previously and relate those to grafana-agent.
Commmands used in video
|
|
Try out your new setup
After previous section it should now be possible to find new dashboards and alert rules in grafana. There should also be a dashboard called Observed Microsample. To trigger alert rules we can start to call observed charms api.
Curl Observed
|
|
Integrate alertmanager with other services
In the observed repo you can find examples configurations for alertmanager that can enable integration with other services like slack and pagerduty to receive notifications. Use following command to push a configuration file to alertmanager.
|
|
To show or check current configuration:
|
|