Ubuntu and Amazon Elastic Container Service for Kubernetes (EKS)

Canonical and Amazon have collaborated on the launch of Amazon’s Elastic Container Service for Kubernetes (EKS) to make Ubuntu worker nodes available. Amazon EKS is a fully managed service that makes it easy for you to use Kubernetes on AWS without having to be an expert in managing Kubernetes clusters.

Users should follow the EKS user guide for deploying an EKS cluster. When launching and configuring Worker Nodes, substitute the Ubuntu CloudFormation nodegroup template and specify the Ubuntu EKS worker node Amazon Machine Image (AMI) ID (see table below). The rest of the instructions remain the same.

The latest Ubuntu worker node AMIs in us-west-2 and us-east-1:

Region Image CloudFormation Node template
Oregon (us-west-2) ami-6322011b (or later) amazon-eks-ubuntu-nodegroup.yaml
Virginia (us-east-1) ami-06fd8200ac0eb656d (or later) amazon-eks-ubuntu-nodegroup.yaml

This image is customized specifically for the EKS service and is not intended as a general OS image.

How to customize set up

Customization is done during first boot and is driven by the script /var/lib/cloud/scripts/per-instance/00-EKS-config.sh. This is executed by cloud-init and output can be seen in /var/lib/cloud-init-output.sh. The script will determine the cluster to join based on the instance tag “Key=kubernetes.io/cluster/<cluster_name>, Value=owned" which should be associated with the instance from the autoscaling group. See the sample CloudFormation template in this same directory named amazon-eks-ubuntu-nodegroup.yaml.

Any user-data passed to the instance will run after the in-image configuration (/var/lib/cloud/scripts/per-instance/00-EKS-config.sh). If you need to override the in-image configuration entirely you may use cloud-init’s runcmd to delete the in-image configuration and use cloud-init’s write_files to substitute your own configuration script in the same directory.

Customization example

Here we have a customization example with complete replacement of the setup script. The ‘runcmd’ stanza would be omitted if the goal is to augment the existing setup rather than replace it entirely. The following would be added to the CloudFormation nodegroup template in the instance userdata property:

# Remove the built-in customization if you want/need to replace it completely
  - [ cloud-init-per, once, rm, -f, /var/lib/cloud/scripts/per-instance/00-EKS-config.sh ]
# Add your own customization
- path: /var/lib/cloud/scripts/per-instance/01-EKS-custom.sh
  permissions: 755
  owner: root:root
  content: |
      #!/bin/bash -eux
      ## Custom EKS setup likely using 00-EKS-config.sh as a guide