MySQL Router K8s

Channel Revision Published Runs on
8.0/stable 155 02 Sep 2024
Ubuntu 22.04
8.0/stable 154 02 Sep 2024
Ubuntu 22.04
8.0/candidate 155 27 Aug 2024
Ubuntu 22.04
8.0/candidate 154 27 Aug 2024
Ubuntu 22.04
8.0/beta 155 20 Aug 2024
Ubuntu 22.04
8.0/beta 154 20 Aug 2024
Ubuntu 22.04
8.0/edge 167 07 Oct 2024
Ubuntu 22.04
8.0/edge 166 07 Oct 2024
Ubuntu 22.04
juju deploy mysql-router-k8s --channel 8.0/candidate
Show information

Platform:

Note: All commands are written for juju >= v3.1

If you’re using juju 2.9, check the juju 3.0 Release Notes.

Enable tracing

This guide contains the steps to enable tracing with Grafana Tempo for your MySQL Router K8s application.

To summarize:

Warning: This is feature is in development. It is not recommended for production environments.

This feature is available for Charmed MySQL Router K8s revision 117+ only.

Prerequisites

Enabling tracing with Tempo requires that you:


Deploy Tempo

First, switch to the Kubernetes controller where the COS model is deployed:

juju switch <k8s_controller_name>:<cos_model_name>

Then, deploy the dependencies of Tempo following this tutorial. In particular, we would want to:

  • Deploy the minio charm
  • Deploy the s3 integrator charm
  • Add a bucket in minio using a python script
  • Configure s3 integrator with the minio credentials

Finally, deploy and integrate with Tempo HA in a monolithic setup.

Offer interfaces

Next, offer interfaces for cross-model integrations from the model where Charmed MySQL Router is deployed.

To offer the Tempo integration, run

juju offer <tempo_coordinator_k8s_application_name>:tracing

Then, switch to the Charmed MySQL Router K8s model, find the offers, and integrate (relate) with them:

juju switch <k8s_controller_name>:<mysql_router_k8s_model_name>

juju find-offers <k8s_controller_name>:  

:exclamation: Do not miss the “:” in the command above.

Below is a sample output where k8s is the K8s controller name and cos is the model where cos-lite and tempo-k8s are deployed:

Store  URL                            Access  Interfaces
k8s    admin/cos.tempo                admin   tracing:tracing

Next, consume this offer so that it is reachable from the current model:

juju consume k8s:admin/cos.tempo

Offer interfaces

First, deploy Grafana Agent K8s from the latest/edge channel:

juju deploy grafana-agent-k8s --channel latest/edge

Then, integrate Grafana Agent k8s with the consumed interface from the previous section:

juju integrate grafana-agent-k8s:tracing tempo:tracing

Finally, integrate Charmed MySQL Router K8s with Grafana Agent K8s:

juju integrate mysql-router-k8s:tracing grafana-agent-k8s:tracing-provider

Wait until the model settles. The following is an example of the juju status --relations on the Charmed MySQL Router K8s model:

Model     Controller  Cloud/Region        Version  SLA          Timestamp
database  k8s         microk8s/localhost  3.5.4    unsupported  18:32:28Z

SAAS   Status  Store       URL
tempo  active  k8s         admin/cos.tempo

App                Version                  Status  Scale  Charm              Channel        Rev  Address         Exposed  Message
grafana-agent-k8s  0.40.4                   active      1  grafana-agent-k8s  latest/edge     93  10.152.183.141  no       grafana-dashboards-provider: off, logging-consumer: off, send-remote-write: off
mysql-k8s          8.0.37-0ubuntu0.22.04.3  active      1  mysql-k8s          8.0/edge       201  10.152.183.58   no       
mysql-router-k8s   8.0.37-0ubuntu0.22.04.3  active      1  mysql-router-k8s                    1  10.152.183.50   no       
mysql-test-app     0.0.2                    active      1  mysql-test-app     latest/stable   51  10.152.183.162  no       

Unit                  Workload  Agent  Address       Ports  Message
grafana-agent-k8s/0*  active    idle   10.1.241.221         grafana-dashboards-provider: off, logging-consumer: off, send-remote-write: off
mysql-k8s/0*          active    idle   10.1.241.213         Primary
mysql-router-k8s/0*   active    idle   10.1.241.222         
mysql-test-app/0*     active    idle   10.1.241.218         

Integration provider                 Requirer                             Interface              Type     Message
grafana-agent-k8s:peers              grafana-agent-k8s:peers              grafana_agent_replica  peer     
grafana-agent-k8s:tracing-provider   mysql-router-k8s:tracing             tracing                regular  
mysql-k8s:database                   mysql-router-k8s:backend-database    mysql_client           regular  
mysql-k8s:database-peers             mysql-k8s:database-peers             mysql_peers            peer     
mysql-k8s:restart                    mysql-k8s:restart                    rolling_op             peer     
mysql-k8s:upgrade                    mysql-k8s:upgrade                    upgrade                peer     
mysql-router-k8s:cos                 mysql-router-k8s:cos                 cos                    peer     
mysql-router-k8s:database            mysql-test-app:database              mysql_client           regular  
mysql-router-k8s:mysql-router-peers  mysql-router-k8s:mysql-router-peers  mysql_router_peers     peer     
mysql-router-k8s:upgrade-version-a   mysql-router-k8s:upgrade-version-a   upgrade                peer     
mysql-test-app:application-peers     mysql-test-app:application-peers     application-peers      peer     
tempo:tracing                        grafana-agent-k8s:tracing            tracing                regular  

Note: All traces are exported to Tempo using HTTP. Support for sending traces via HTTPS is an upcoming feature.

View traces

After this is complete, the Tempo traces will be accessible from Grafana under the Explore section with tempo-k8s as the data source. You will be able to select mysql-router-k8s as the Service Name under the Search tab to view traces belonging to Charmed MySQL Router K8s.

Below is a screenshot demonstrating a Charmed MySQL Router K8s trace:

Feel free to read through the Tempo HA documentation at your leisure to explore its deployment and its integrations.