Deploy an Ubuntu Pro EKS cluster - using Pro tokens

This guide shows how to deploy an EKS cluster with Ubuntu Pro nodes using Ubuntu Pro tokens and EC2 launch templates.

Prerequisites

You need:

  • eksctl: Check the instructions to install eksctl

  • packer: only needed if you want to enable FIPS for the cluster nodes. Install it with sudo snap install packer

  • your AWS access key ID and secret access key

  • an Ubuntu Pro token

Prepare the cluster for deployment

Although Ubuntu Pro for EKS is available as an AMI for Ubuntu 22.04 LTS (see Deploy an Ubuntu Pro EKS cluster - using a Pro AMI), there is no such EKS related offer available for Ubuntu 20.04 LTS. So to use Pro in 20.04 LTS, you need to provision the EKS cluster with customised Ubuntu nodes.

The steps needed for deploying the cluster depend on whether you need to enable FIPS or not.

When FIPS is not enabled, you can use one of the existing Ubuntu EKS AMIs and customise it using cloud-init’s ubuntu-advantage module during deployment.

For this deployment, you’ll also need to have an existing launch template on AWS.

Update user-data in launch template

On the advanced section of your launch template (user-data section), copy the following code (replacing the “token” field with your Pro token):

MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="==MYBOUNDARY=="

--==MYBOUNDARY==
Content-Type: text/cloud-config; charset="us-ascii"
ubuntu_advantage:
token: <pro_token>
enable:
- esm

--==MYBOUNDARY==
Content-Type: text/x-shellscript; charset="us-ascii"

#!/bin/bash
sudo /etc/eks/bootstrap.sh procluster

--==MYBOUNDARY==--

Cloud-init will use this user-data to enable ESM on the cluster nodes and bootstrap the AWS EKS cluster.

Create the eksctl config file

You’re now ready to deploy the EKS cluster with Ubuntu Pro nodes. To do so, start by creating a cluster.yaml with the following content

apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: procluster
region: us-east-1
version: 'YOUR_EKS_VERSION'

Add the following content to your file

managedNodeGroups:
- name: ng-procluster
desiredCapacity: 2
launchTemplate:
  id: lt-12345
  version: "1"

This config file will allow you to create an EKS cluster using the launch template from above, with two nodes.

For further cluster customisation check out eksctl details.

Create the EKS cluster

To create the EKS cluster, run eksctl create cluster -f cluster.yaml (you might need to specify the --profile option if you have multiple profiles). When this command finishes, see the nodes with

$ kubectl get nodes

NAME                                           STATUS   ROLES    AGE     VERSION
ip-xxx-xxx-xx-xxx.us-east-1.compute.internal   Ready    <none>   2m45s   v1.23.x
ip-xxx-xxx-x-xx.us-east-1.compute.internal     Ready    <none>   2m45s   v1.23.x

(Optional) Verify Pro subscription

To check that the deployed nodes have Ubuntu Pro, run:

$ aws --region <region_name> ec2 describe-instances \
      --filters Name=instance-state-name,Values=running \
      --query 'Reservations[*].Instances[*].[InstanceType, LaunchTime, PlatformDetails]'
      --output table

----------------------------------------------------------------
|                       DescribeInstances                      |
+-----------+-----------------------------+--------------------+
|  t3.medium|  2024-05-07T19:57:33+00:00  |  Ubuntu Pro Linux  |
|  t3.medium|  2024-05-07T19:57:33+00:00  |  Ubuntu Pro Linux  |
+-----------+-----------------------------+--------------------+