Juju with Amazon Elastic Kubernetes Service (Amazon EKS)
Running through 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 AWS Elastic Kubernetes Service. That means, once you’ve registered your cluster, you’ll be able to deploy workloads straight away.
This guide covers:
- making sure all necessary software is installed
- all configuration is in place
- a live Juju controller is available
- a Juju model has been created
Software to Install
Using Juju to drive Kubernetes workloads on AKS requires installing some pre-requisite software:
- Juju client
- AWS command line interface
- Kubernetes client
Juju client (juju
)
You will need to install Juju. If you’re on Linux, we recommend using snap:
snap install juju --classic
We also provide other installation methods as described on our detailed installation documentation.
AWS Command Line Interface (aws
)
AWS publishes three command-line interfaces:
aws-shell
-
aws
version 2 -
aws
version 1
Any of them will enable Juju and AWS to communicate. Installation instructions are provided by AWS.
EKS Command Line Interface (eksctl
)
eksctl
is a tool for greatly simplifying the process of creating clusters on EKS.
eksctl
installation instructions are provided by AWS.
Kubernetes client (kubectl
)
kubectl
is the command-line client for directly interacting with a Kubernetes cluster. Visit the Kubernetes documentation for manual kubectl
installation instructions.
Provision a Kubernetes cluster on Elastic Kubernetes Service
You will need to have an EKS cluster available before Juju can connect to it. It’s easy to do that via the EKS section of the AWS cloud console.
eksctl create cluster \
--name <cluster> \
--node-ami-family=Ubuntu1804 \
--node-type='m5.large'
Full documentation on creating a cluster is available from AWS.
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.
Linking the cluster to the local environment
Enable kubectl
If you’ve used eksctl
to provision your cluster, kubectl
config file has already been loaded. Otherwise, you’ll need to update it yourself.
Use the update-kubeconfig
sub-command underneath aws eks
.
aws eks --region <region> \
update-kubeconfig
--name <cluster>
If you experience difficulties at this step, detailed instructions are provided by the Amazon EKS documentation.
Verify kubectl
set up
To check that you have configured kubectl
correctly, execute a command:
kubectl get nodes
Set up Juju within the cluster
Now that the pieces are in place, let’s join them together. This is a three step process:
- registering the cluster as a “K8s cloud”
- deploying a Juju controller within the cluster
- creating a “model” (namespace) to house our deployment(s)
Register the cluster as a “K8s cloud”
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>
will be used by Juju to refer to the cluster later on.
juju add-k8s --eks <cloud>
Create a controller
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> <controller>
Create a model
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>
Deploy workloads
You’re now able to deploy workloads into your model. Workloads are provided by charms (and sets of charms called bundles).
Use the Kubernetes filter in the Charm Store to find Kubernetes workloads to deploy, e.g. https://jaas.ai/search?type=charm&series=kubernetes.
Last updated 2 months ago.