Kubernetes Dashboard

  • By Canonical Kubernetes
Channel Revision Published Runs on
latest/stable 57 17 Apr 2024
Ubuntu 22.04
latest/candidate 57 15 Apr 2024
Ubuntu 22.04
latest/beta 47 17 Apr 2024
Ubuntu 22.04
latest/edge 47 17 Aug 2023
Ubuntu 22.04
1.30/edge 47 13 Mar 2024
Ubuntu 22.04
1.29/stable 57 17 Apr 2024
Ubuntu 22.04
1.29/candidate 57 15 Apr 2024
Ubuntu 22.04
1.29/beta 47 17 Apr 2024
Ubuntu 22.04
1.29/edge 47 21 Aug 2023
Ubuntu 22.04
1.28/stable 35 22 Aug 2023
Ubuntu 22.04
1.28/beta 35 07 Aug 2023
Ubuntu 22.04
1.28/edge 47 17 Aug 2023
Ubuntu 22.04
juju deploy kubernetes-dashboard
Show information

Platform:

charms.kubernetes_dashboard.v0.cert

Self-Signed Certificate Generator.

This charm library contains a class SelfSignedCert which can be used for generating self-signed RSA certificates for use in TLS connections or otherwise. It does not currently provide much configurability, apart from the FQDN the certificate should be associated with, a list of IP addresses to be present in the Subject Alternative Name (SAN) field, validity and key length.

By default, generated certificates are valid for 365 years, and use a 2048-bit key size.

Getting Started

In order to use this library, you will need to fetch the library from Charmhub as normal, but you will also need to add a dependency on the cryptography package to your charm:

cd some-charm
charmcraft fetch-lib charms.kubernetes_dashboard.v0.cert
echo <<-EOF >> requirements.txt
cryptography
EOF

Once complete, you can import the charm and use it like so (in the most simple form):

# ...
from charms.kubernetes_dashboard.v0.cert import SelfSignedCert
from ipaddress import IPv4Address

# Generate a certificate
self_signed_cert = SelfSigned(names=["test-service.dev"], ips=[IPv4Address("10.28.0.20")])

# Bytes representing the certificate in PEM format
certificate = self_signed_cert.cert

# Bytes representing the private key in PEM/PKCS8 format
key = self_signed_cert.key

You can also specify the validity period in days, and the required key size. The algorithm is always RSA:

# ...
from charms.kubernetes_dashboard.v0.cert import SelfSignedCert
from ipaddress import IPv4Address

# Generate a certificate
self_signed_cert = SelfSigned(
    names=["some_app.my_namespace.svc.cluster.local"],
    ips=[IPv4Address("10.41.150.12"), IPv4Address("192.168.0.20")],
    key_size = 4096,
    validity = 3650
)

class SelfSignedCert

Description

A class used for generating self-signed RSA TLS certificates. None

Methods

SelfSignedCert. __init__( self )

Initialise a new self-signed certificate.

Arguments

names

A list of FQDNs that should be placed in the Subject Alternative Name field of the certificate. The first name in the list will be used as the Common Name, Subject and Issuer field.

ips

A list of IPv4Address objects that should be present in the list of Subject Alternative Names of the certificate.

key_size

Size of the RSA Private Key to be generated. Defaults to 2048

validity

Period in days the certificate is valid for. Default is 365.