Create an MLOps-ready Charmed Kubernetes cluster

This how-to guide will show you how to create a Charmed Kubernetes (CK8s) cluster with an appropriate configuration for deploying an MLOps platforms such as Kubeflow or MLflow.

Prerequisites

Install and set up AWS CLI

First, install the AWS CLI on your local machine, and then set it up. You can use any of the authentication methods available for the AWS CLI. For example, you can use IAM user credentials.

Install other tools

To install some helpful tools, run this command:

sudo snap install juju --classic --channel=2.9/stable
for snap in juju-wait kubectl jq; \
  do sudo snap install $snap --classic; \
done

This installs the following:

  • juju: Needed to deploy and manage the CK8s cluster.

  • juju-wait: CLI tool used for waiting during Juju deployments.

  • kubectl: Kubernetes client used to communicate with a Kubernetes cluster.

  • jq: A lightweight and versatile command-line tool for parsing and manipulating JSON data.

Setup Juju with AWS

Set up Juju to communicate with AWS.

juju add-credential aws

You will be prompted for information related to your AWS account that you provided while setting up the AWS CLI (e.g., access key, secret access key).

Create Juju controller

Bootstrap a Juju controller that will be responsible for deploying cluster applications.

juju bootstrap aws kf-controller

Deploy Charmed Kubernetes 1.24

Clone the Charmed Kubernetes bundle repository, and update CPU, disk, and memory constraints to meet Kubeflow requirements.

git clone https://github.com/charmed-kubernetes/bundle
sed -i '/^ *charm: kubernetes-worker/,/^ *[^:]*:/s/constraints: cores=2 mem=8G root-disk=16G/constraints: cores=8 mem=32G root-disk=200G/' ./bundle/releases/1.24/bundle.yaml

Deploy the Charmed Kubernetes bundle on AWS with the storage overlay. This overlay enables you to create Kubernetes volumes backed by AWS EBS.

juju deploy ./bundle/releases/1.24/bundle.yaml \
  --overlay ./bundle/overlays/aws-storage-overlay.yaml --trust

Wait until all components are ready.

juju-wait -m default -t 3600

Retrieve the Kubernetes configuration from the control plane leader unit.

mkdir ~/.kube
juju ssh kubernetes-control-plane/leader -- cat config > ~/.kube/config

Now you can use kubectl to talk to your newly created Charmed Kubernetes cluster.