Charmed MySQL K8s How to | Deploy on Canonical Kubernetes

How to deploy on Canonical Kubernetes

Canonical Kubernetes is a Kubernetes service built on Ubuntu and optimized for most major public clouds.

This guide shows you how to deploy Charmed MySQL K8s to Canonical Kubernetes.

Summary

This guide assumes you have a spare hardware/VMs running Ubuntu 22.04 LTS (or newer).


Install Canonical Kubernetes

The following instructions are a complete but summarized version of the steps for installing Canonical K8s. For more thorough instructions and details, see the official Canonical Kubernetes documentation: Install Canonical Kubernetes from a snap.

Install, bootstrap, and check the status of Canonical K8s with the following commands:

sudo snap install k8s --edge --classic
sudo k8s bootstrap
sudo k8s status --wait-ready

Once Canonical K8s is up and running, enable the local storage (or any another persistent volumes provider, to be used by Juju Storage later):

sudo k8s enable local-storage
sudo k8s status --wait-ready

(Optional) Install kubectl tool and dump the K8s config:

sudo snap install kubectl --classic
mkdir ~/.kube
sudo k8s config > ~/.kube/config
kubectl get namespaces # to test the credentials

Install Juju

Install Juju and bootstrap the first Juju controller in K8s:

sudo snap install juju --channel 3.6/candidate
juju add-k8s ck8s --client --context-name="k8s"
juju bootstrap ck8s

Deploy Charmed MySQL K8s

juju add-model mysql
juju deploy mysql-k8s --trust

follow the deployment progress using:

juju status --watch 1s

Example output:

Model   Controller  Cloud/Region  Version  SLA          Timestamp
mysql   ck8s        ck8s          3.6-rc1  unsupported  18:32:38+01:00

App         Version                  Status  Scale  Charm           Channel     Rev  Address         Exposed  Message
mysql-k8s   8.0.37-0ubuntu0.22.04.3  active      1  mysql-k8s       8.0/stable  180  10.152.183.146  no       

Unit           Workload  Agent  Address    Ports  Message
mysql-k8s/0*   active    idle   10.1.0.11         Primary

Next steps: Learn how to scale your application, relate with other applications and more!