|
| 1 | +# Building Ubuntu 24.04 vSphere OVAs with Kubernetes for CAPI |
| 2 | + |
| 3 | +This guide walks you through building vSphere OVA templates 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. vSphere Prerequisites |
| 17 | + |
| 18 | +You'll need: |
| 19 | +- A vSphere environment |
| 20 | +- vSphere credentials with permissions to create VMs and templates |
| 21 | + |
| 22 | +### 3. Create vSphere Credentials File |
| 23 | + |
| 24 | +Create a `vsphere.json` file with your vSphere credentials: |
| 25 | + |
| 26 | +```bash |
| 27 | +cat > packer/ova/vsphere.json <<EOF |
| 28 | +{ |
| 29 | + "vcenter_server": "vcenter.example.com", |
| 30 | + |
| 31 | + "password": "your-password", |
| 32 | + "datacenter": "Datacenter", |
| 33 | + "cluster": "Cluster", |
| 34 | + "datastore": "datastore1", |
| 35 | + "folder": "Templates", |
| 36 | + "network": "VM Network", |
| 37 | + "insecure_connection": "true" |
| 38 | +} |
| 39 | +EOF |
| 40 | +``` |
| 41 | + |
| 42 | +## Building vSphere OVA |
| 43 | + |
| 44 | +### Step 1: Install Dependencies |
| 45 | + |
| 46 | +The build process needs Packer and Ansible. Install them with: |
| 47 | + |
| 48 | +```bash |
| 49 | +make deps-ami |
| 50 | +``` |
| 51 | + |
| 52 | +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: |
| 53 | + |
| 54 | +```bash |
| 55 | +export PATH="$(pwd)/.local/bin:$PATH" |
| 56 | +``` |
| 57 | + |
| 58 | +### Step 2: Choose Your Kubernetes Version |
| 59 | + |
| 60 | +Create a config file with the Kubernetes version you want: |
| 61 | + |
| 62 | +**For Kubernetes v1.33.5:** |
| 63 | +```bash |
| 64 | +cat > my-k8s-config.json <<EOF |
| 65 | +{ |
| 66 | + "kubernetes_deb_version": "1.33.5-1.1", |
| 67 | + "kubernetes_rpm_version": "1.33.5", |
| 68 | + "kubernetes_semver": "v1.33.5", |
| 69 | + "kubernetes_series": "v1.33" |
| 70 | +} |
| 71 | +EOF |
| 72 | +``` |
| 73 | + |
| 74 | +### Step 3: Build the vSphere OVA |
| 75 | + |
| 76 | +Build Ubuntu 24.04 with your chosen Kubernetes version: |
| 77 | + |
| 78 | +```bash |
| 79 | +PACKER_VAR_FILES="$(pwd)/my-k8s-config.json" make build-node-ova-vsphere-ubuntu-2404 |
| 80 | +``` |
| 81 | + |
| 82 | +What happens: |
| 83 | +1. Packer connects to vSphere |
| 84 | +2. Creates a new VM from Ubuntu 24.04 ISO |
| 85 | +3. Installs Kubernetes and dependencies |
| 86 | +4. Runs Ansible playbooks to configure everything |
| 87 | +5. Converts the VM to a template |
| 88 | +6. Cleans up the temporary build VM |
| 89 | + |
| 90 | +Build time is usually 1-1.5 hours due to image download/upload. |
| 91 | + |
| 92 | +### Step 4: Verify Your Template |
| 93 | + |
| 94 | +When the build finishes, check that your template was created in vSphere: |
| 95 | + |
| 96 | +1. Log in to vCenter |
| 97 | +2. Navigate to your configured folder |
| 98 | +3. Look for a template named like: `ubuntu-2404-kube-v1.33.5` |
| 99 | + |
| 100 | +Save the template name - you'll need it for your CAPI clusters. |
0 commit comments