Self Signed X.509 Certificates
- Canonical Telco
Channel | Revision | Published | Runs on |
---|---|---|---|
latest/stable | 155 | 04 Jul 2024 | |
latest/candidate | 155 | 04 Jul 2024 | |
latest/beta | 155 | 04 Jul 2024 | |
latest/edge | 208 | Yesterday | |
latest/edge | 207 | Yesterday |
juju deploy self-signed-certificates --channel beta
Deploy universal operators easily with Juju, the Universal Operator Lifecycle Manager.
Platform:
Getting started
In this tutorial, we will use the Self Signed Certificates charm to provide certificates to a requiring charm using the TLS Certificates Requirer Operator as our TLS certificates requirer.
1. Install pre-requisites
Install MicroK8s:
sudo snap install microk8s
Enable the hostpath-storage
MicroK8s add-on:
microk8s enable hostpath-storage
Install Juju:
sudo snap install juju
2. Bootstrap a Juju controller
Bootstrap a Juju controller:
juju bootstrap microk8s
Create a Juju model:
juju add-model demo
3. Deploy Self Signed Certificates
juju deploy self-signed-certificates
4. Deploy tls-certificates-requirer
juju deploy tls-certificates-requirer --channel=edge
5. Integrate the two charms
Integrate the charms with their tls-certificates interface:
juju integrate self-signed-certificates tls-certificates-requirer
Wait for both charms to be in the active/idle status.
ubuntu@server:~$ juju status
Model Controller Cloud/Region Version SLA Timestamp
demo microk8s-localhost microk8s/localhost 3.1.7 unsupported 08:41:14-05:00
App Version Status Scale Charm Channel Rev Address Exposed Message
self-signed-certificates active 1 self-signed-certificates stable 57 10.152.183.96 no
tls-certificates-requirer active 1 tls-certificates-requirer edge 28 10.152.183.45 no Certificate is available
Unit Workload Agent Address Ports Message
self-signed-certificates/0* active idle 10.1.182.39
tls-certificates-requirer/0* active idle 10.1.182.21 Certificate is available
6. Retrieve the TLS Certificates
Use the TLS Certificates Requirer’s get-certificate
action to retrieve the certificate it received from Self Signed Certificates:
juju run tls-certificates-requirer/0 get-certificate
You should expect this output (with different certificates of course):
ubuntu@server:~$ juju run tls-certificates-requirer/0 get-certificate
Running operation 1 with 1 task
- task 2 on unit-tls-certificates-requirer-0
Waiting for task 2...
ca-certificate: |-
-----BEGIN CERTIFICATE-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jONgKz+HSWlrUB5/x
aTLXgQX/OU1ZWEnDHggL9x9oiCy3wHpHhrZ6+koNkXilELbcbuGc7IA8qLWgAESi
LzvN/MG+D8ppqD+lt3/pgZ1YrCGylAb+D6d01U2mpt7yASW4lIW6oqQKV2z02k1E
Puf4y3KcZ61TPr8vRQs4aj+k4voG55OxYkbrRCaQJ+AaV8YFVXbT29r3hobUwfqm
UnU4
-----END CERTIFICATE REQUEST-----
Good job, you successfully used the Self Signed Certificates charm to provide charm to a requiring charm.
7. Destroy the environment
Kill the Juju controller:
juju kill-controller microk8s-localhost
Uninstall the Juju and MicroK8s snaps:
sudo snap remove microk8s juju --purge