Create a Charmed Kubernetes cluster for use with an MLOps platform on AWS

Welcome to the Charmed Kubernetes cluster guide. This how-to guide will take you through the steps of creating a Charmed Kubernetes cluster with an appropriate configuration for deploying an MLOps platform such as Kubeflow or MLflow.

Prerequisites

Contents:

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

Next, we install the following tools:

  • juju: Juju is an open-source application and service modeling tool that simplifies the deployment and management of complex software systems in cloud and container environments.
  • 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.

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

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.git
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 updated 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.