Charmed Kubernetes on AWS
Charmed Kubernetes will run seamlessly on AWS. With the addition of the
aws-integrator
and its companion charms, your cluster will also be able
to directly use AWS native features.
AWS integrator
The aws-integrator
charm simplifies working with Charmed Kubernetes on
AWS. Using the credentials provided to Juju, it acts as a proxy between
Charmed Kubernetes and the underlying cloud, granting permissions to
dynamically create, for example, EBS volumes.
AWS K8S Storage
The aws-k8s-storage
charm moves the AWS specific functions of the EBS csi-driver
out-of-tree. Using this charm, the drivers are installed as workloads in the Kubernetes
cluster instead of as natural code paths of the Kubernetes binaries.
AWS Cloud Provider
The aws-cloud-provider
moves the AWS specific functions of the cloud-provider
out-of-tree. The AWS cloud provider provides the interface between a Kubernetes cluster
and AWS service APIs. This project allows a Kubernetes cluster to provision,
monitor and remove AWS resources necessary for operation of the cluster.
Version support
From Kubernetes 1.27
The in-tree cloud-provider is no longer available, and must be deployed
as container workloads in the cluster. Charmed Kubernetes recommends
using the aws-cloud-provider
charm to access AWS Service APIs.
Prior to Kubernetes 1.27
The in-tree cloud-provider is natively available in Kubernetes until the 1.27
release, and it is not necessary to deploy the aws-cloud-provider
charm as in the
above overlay.
Installing
If you install Charmed Kubernetes using the Juju bundle, you can add the aws-integrator at the same time by using the following cloud-provider overlay file (download it here):
As well as the storage overlay file (download it here):
To use these overlays with the Charmed Kubernetes bundle, it is specified during deploy like this:
... and remember to fetch the configuration file!
For more configuration options and details of the permissions which the integrator uses, please see the charm readme.
Using EBS volumes
Many pods you may wish to deploy will require storage. Although you can use any type of storage supported by Kubernetes (see the storage documentation), you also have the option to use the native AWS storage, Elastic Block Store (EBS).
Beginning in Kubernetes 1.25
The aws-k8s-storage
charm will need to be installed to make use of EBS Volumes.
Amazon removed CSIMigration away from the in-tree binaries but made them available
as container workload in the cluster. This charm installs and relates to the
existing integrator charm.
A StorageClass will be created by this charm named csi-aws-ebs-default
You can confirm this has been added by running:
which should return:
Prior to Kubernetes 1.25
First we need to create a storage class which can be used by Kubernetes. To start with, we will create one for the ‘General Purpose SSD’ type of EBS storage:
You can confirm this has been added by running:
which should return:
You can create additional storage classes for the other types of EBS storage if needed, simply give them a different name and replace the ‘type: gp2’ with a different type (See the AWS website for more information on the available types).
Creating a PVC
To actually create storage using this new class, you can make a Persistent Volume Claim:
This should finish with a confirmation. You can check the current PVCs with:
...which should return something similar to:
This PVC can then be used by pods operating in the cluster. As an example, the following
deploys a busybox
pod:
Using ELB Loadbalancers
With the aws-integrator charm in place, actions which invoke a loadbalancer in Kubernetes will automatically generate an AWS Elastic Load Balancer. This can be demonstrated with a simple application. Here we will create a simple application and scale it to five pods:
You can verify that the application and replicas have been created with:
Which should return output similar to:
To create a LoadBalancer, the application should now be exposed as a service:
To check that the service is running correctly:
...which should return output similar to:
You can see that the LoadBalancer Ingress is now associated with an ELB address in front of the five endpoints of the example deployment. Leaving a while for DNS propagation, you can test the ingress address:
Hello Kubernetes!
Upgrading the charms
The charm aws-integrator
, aws-cloud-provider
and aws-k8s-storage
can be refreshed within the current charm channel without concern and
can be upgraded at any time with the following command,
It isn’t recommended to switch charm channels unless a full charm upgrade is planned.
Troubleshooting
If you have any specific problems with the aws-integrator, you can report bugs on Launchpad.
The aws-integrator charm makes use of IAM accounts in AWS to perform actions, so useful information can be obtained from Amazon’s CloudTrail, which logs such activity.
For logs of what the charm itself believes the world to look like, you can use Juju to replay the log history for that specific unit:
See also:
If you are an AWS user, you may also be interested in how to use AWS IAM for authorisation and authentication.
See the guide to contributing or discuss these docs in our public Mattermost channel.