Apache Kafka - K8s

Channel Revision Published Runs on
latest/stable 5 09 Mar 2022
Ubuntu 20.04
latest/edge 27 25 Apr 2023
Ubuntu 22.04 Ubuntu 20.04
latest/edge 13 21 Oct 2022
Ubuntu 22.04 Ubuntu 20.04
3/stable 56 27 Feb 2024
Ubuntu 22.04
3/candidate 56 27 Feb 2024
Ubuntu 22.04
3/beta 56 27 Feb 2024
Ubuntu 22.04
3/edge 76 11 Dec 2024
Ubuntu 22.04
juju deploy kafka-k8s --channel 3/stable
Show information

Platform:

This is part of the Charmed Apache Kafka Tutorial. Please refer to this page for more information and an overview of the content.

Setup the environment

Multipass is a quick and easy way to launch virtual machines running Ubuntu. It uses “cloud-init” standard to install and configure all the necessary parts automatically.

Let’s install Multipass from Snap and launch a new VM using “charm-dev” cloud-init config:

sudo snap install multipass && \
multipass launch --cpus 4 --memory 8G --disk 50G --name my-vm charm-dev

Note: See all multipass launch parameters in the launch command documentation.

Multipass list of commands is short and self-explanatory, e.g. show all running VMs:

multipass list

As soon as the new VM starts, enter:

multipass shell my-vm

Note: if at any point you’d like to leave Multipass VM, use Ctrl+D or type exit.

All the parts have been pre-installed inside VM already, like MicroK8s, LXD and Juju (the files /var/log/cloud-init.log and /var/log/cloud-init-output.log contain all low-level installation details). Also, the image already comes with two Juju controllers already setup, one for LXD and one for MicroK8s

$ juju list-controllers
Use --refresh option with this command to see the latest information.

Controller  Model     User   Access     Cloud/Region         Models  Nodes    HA  Version
lxd*        tutorial  admin  superuser  localhost/localhost       2      1  none  3.1.5
microk8s    -         admin  superuser  microk8s/localhost        1      1     -  3.1.5

Make sure that you use the controller bound to the MicroK8s cluster, e.g.:

juju switch microk8s

The Juju controller can work with different models; models host applications such as Charmed Apache Kafka K8s. Set up a specific model for Charmed Apache Kafka K8s named tutorial:

juju add-model tutorial

You can now view the model you created above by entering the command juju status into the command line. You should see the following:

Model     Controller  Cloud/Region        Version  SLA          Timestamp
tutorial  microk8s    microk8s/localhost  3.1.5    unsupported  15:46:55+02:00

Model "admin/tutorial" is empty.