Skip to content

Commit d994611

Browse files
Merge pull request #1865 from alexander-demicev/ec2kubeadmimage
Document building EC2 Kubeadm AMI
2 parents d74083d + 83f7fcb commit d994611

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

docs/image-builder/ec2-kubeadm.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Building Ubuntu 24.04 AMIs with Kubernetes for CAPI
2+
3+
This guide walks you through building AWS AMIs for Cluster API with Ubuntu 24.04 and any Kubernetes version you need.
4+
5+
## Getting Started
6+
7+
### 1. Clone the Repository
8+
9+
First, clone the image-builder repo:
10+
11+
```bash
12+
git clone [email protected]:kubernetes-sigs/image-builder.git
13+
cd image-builder/images/capi
14+
```
15+
16+
### 2. AWS Prerequisites
17+
18+
You'll need:
19+
- An AWS account with EC2 permissions to create AMIs.
20+
- AWS CLI installed and configured
21+
22+
## Building AMI
23+
24+
### Step 1: Install Dependencies
25+
26+
The build process needs Packer and Ansible. Install them with:
27+
28+
```bash
29+
make deps-ami
30+
```
31+
32+
This installs Python, Ansible, Packer, and initializes Packer plugins. If you're on macOS, the tools get installed to `.local/bin` in the current directory. Add them to your PATH:
33+
34+
```bash
35+
export PATH=$PWD/.local/bin:$PATH
36+
```
37+
38+
### Step 2: Choose Your Kubernetes Version
39+
40+
Create a config file with the Kubernetes version you want:
41+
42+
**For Kubernetes v1.33.5:**
43+
```bash
44+
cat > my-k8s-config.json <<EOF
45+
{
46+
"aws_region": "eu-west-2",
47+
"ami_regions": "",
48+
"ami_groups": "",
49+
"snapshot_groups": "",
50+
"kubernetes_deb_version": "1.33.5-1.1",
51+
"kubernetes_rpm_version": "1.33.5",
52+
"kubernetes_semver": "v1.33.5",
53+
"kubernetes_series": "v1.33"
54+
}
55+
EOF
56+
```
57+
58+
### Step 3: Build the AMI
59+
60+
Build Ubuntu 24.04 with your chosen Kubernetes version:
61+
62+
```bash
63+
PACKER_VAR_FILES="$(pwd)/my-k8s-config.json" make build-ami-ubuntu-2404
64+
```
65+
66+
What happens:
67+
1. Packer launches a temporary EC2 instance
68+
2. Installs Kubernetes and dependencies
69+
3. Runs Ansible playbooks to configure everything
70+
4. Creates an AMI snapshot
71+
5. Cleans up the temporary instance
72+
73+
Build time is usually 10-20 minutes.
74+
75+
### Step 4: Save Your AMI ID
76+
77+
When the build finishes, you'll see:
78+
79+
```bash
80+
==> Builds finished. The artifacts of successful builds are:
81+
--> amazon-ebs.ubuntu-2404: AMIs were created:
82+
eu-west-2: ami-0abc123def456789
83+
```
84+
85+
Save that AMI ID - you'll need it for your CAPI clusters.

0 commit comments

Comments
 (0)