This guide will ensure that you’re ready to deploy and manage Kubernetes workloads on AWS Elastic Kubernetes Service (EKS) with Juju. Juju provides built-in support for EKS. Once you’ve registered your cluster, you’ll be able to deploy workloads from Charmhub straight away.
- Provision a Kubernetes cluster on AWS
- Connect Juju to your Kubernetes cluster
- Deploy workloads
- Clean up
Using Juju to drive Kubernetes workloads on EKS requires installing some prerequisite software:
- Juju client
- AWS CLI and eksctl
- Kubernetes client
You will need to install Juju. If you’re on Linux, we recommend using
sudo snap install juju --classic
We also provide other installation methods as described on our detailed installation documentation.
The AWS CLI is a cross-platform command-line utility for interacting with AWS. For installation instructions, visit the AWS documentation.
eksctl is a utility for creating and interacting with Amazon Elastic Kubernetes Service instances. Installation instructions can be found in the AWS documentation.
kubectl is the command-line client for directly interacting with a Kubernetes cluster. Visit the Kubernetes documentation for manual
kubectl installation instructions.
Amazon AWS resources can be created using the AWS CLI tools, through the AWS Console and a myriad of other methods. In this guide, we will create and manage resources using the CLI tools.
Ensure your CLI tools are authenticated with AWS:
Further information about authenticating with the AWS command-line tools is available.
We will use
eksctl to create our cluster:
eksctl create cluster \ --name <cluster> \ --region <region> \ --node-ami-family “Ubuntu2004” \ --node-type ”m5.large”
When specifying a
--node-type, ensure that you request a machine type that provides at least 6 GB memory. This provides sufficient resources to enable Juju to be deployed alongside the Kubernetes control plane and your workloads.
If you’ve used
eksctl to provision your cluster,
kubectl config file has already been loaded. Verify that you have access by enumerating the nodes in the cluster:
kubectl get nodes
”I didn’t use eksctl - how do I connect?
If you created your EKS cluster using the AWS Console or the
aws CLI command, you can use the
update-kubeconfig to fetch the
aws eks --region <region> update-kubeconfig --name <cluster>
If you experience difficulties at this step, detailed instructions are provided by the Amazon EKS documentation.
There are three distinct stages to configuring your EKS cluster for management with Juju:
Register the cluster as a Kubernetes cloud
Deploy a Juju controller to the cluster
Create a model to house our applications
In Juju’s vocabulary, a cloud is a space that can host deployed workloads. To register a Kubernetes cluster with Juju, execute the
juju add-k8s command. The
<cloud> argument is your specified name for the cloud, and will be used by Juju to refer to the cluster.
juju add-k8s <cloud-name>
Juju, as an active agent system, requires a controller to get started. Controllers are created with the
juju bootstrap command that takes a cloud’s name and our intended name for the controller.
juju bootstrap <cloud>
(Optional) Specify a controller name
You can specify the name of your Juju controller if you wish:
juju bootstrap <cloud> <controller-name>
If you do not, Juju will generate the name using the name of the cloud.
A model is a workspace for inter-related applications. They correspond (roughly) to a Kubernetes namespace. To create one, use
juju add-model with a name of your choice:
juju add-model <model-name>
You’re now able to deploy workloads into your model. Workloads are provided by charms (and sets of charms called bundles). You can find a list of Kubernetes charms on Charmhub!
The following instructions allow you to undo everything we just did!
The following commands are destructive, and will destroy all running workloads that were deployed with Juju, then remove the EKS cluster.
Remove the Juju controller and any workloads deployed:
juju kill-controller -y -t0 <controller>
Delete the EKS cluster
eksctl delete cluster <cluster>