Skip to main content

Your submission was sent successfully! Close

Thank you for signing up for our newsletter!
In these regular emails you will find the latest updates from Canonical and upcoming events where you can meet our team.Close

Thank you for contacting us. A member of our team will be in touch shortly. Close

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 PostgreSQL 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 local storage (or any another persistent volume 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 PostgreSQL K8s

juju add-model postgresql
juju deploy postgresql-k8s --trust

follow the deployment progress using:

juju status --watch 1s

Example output:

Model       Controller  Cloud/Region  Version  SLA          Timestamp
postgresql  ck8s        ck8s          3.6-rc1  unsupported  17:25:11+01:00

App             Version   Status  Scale  Charm           Channel     Rev  Address         Exposed  Message
postgresql-k8s  14.12     active      1  postgresql-k8s  14/stable   381  10.152.183.30   no       

Unit               Workload  Agent  Address    Ports  Message
postgresql-k8s/0*  active    idle   10.1.0.16         Primary

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

Last updated 21 days ago. Help improve this document in the forum.