sigs.k8s.io/cluster-api-provider-aws@v1.5.5/docs/book/src/topics/images/custom-amis.md (about) 1 # Custom Kubernetes AMIs 2 3 Cluster API uses the Kubernetes [Image Builder][image-builder] tools. You should use the [AWS images][image-builder-aws] from that project as a starting point for your custom image. 4 5 [The Image Builder Book][capi-images] explains how to build the images defined in that repository, with instructions for [AWS CAPI Images][aws-capi-images] in particular. 6 7 ## Operating system requirements 8 9 For custom images to work with Cluster API, it must meet the operating system requirements of the bootstrap provider. For example, the default `kubeadm` bootstrap provider has a set of [`preflight checks`][kubeadm-preflight-checks] that a VM is expected to pass before it can join the cluster. 10 11 ## Kubernetes version requirements 12 13 The pre-built public images are each built to support a specific version of Kubernetes. When using custom images, make sure to match the image to the `version:` field of the `KubeadmControlPlane` and `MachineDeployment` in the YAML template for your workload cluster. 14 15 To upgrade to a new Kubernetes release with custom images requires this preparation: 16 17 - create a new custom image which supports the Kubernetes release version 18 - copy the existing `AWSMachineTemplate` and change its `ami:` section to reference the new custom image 19 - create the new `AWSMachineTemplate` on the management cluster 20 - modify the existing `KubeadmControlPlane` and `MachineDeployment` to reference the new `AWSMachineTemplate` and update the `version:` field to match 21 22 See [Upgrading workload clusters][upgrading-workload-clusters] for more details. 23 24 ## Creating a cluster from a custom image 25 26 To use a custom image, it needs to be referenced in an `ami:` section of your `AWSMachineTemplate`. 27 28 ```yaml 29 apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 30 kind: AWSMachineTemplate 31 metadata: 32 name: capa-image-id-example 33 namespace: default 34 spec: 35 template: 36 spec: 37 ami: 38 id: ami-09709369c53539c11 39 iamInstanceProfile: control-plane.cluster-api-provider-aws.sigs.k8s.io 40 instanceType: m5.xlarge 41 sshKeyName: default 42 ``` 43 44 [capi-images]: https://image-builder.sigs.k8s.io/capi/capi.html 45 [image-builder]: https://github.com/kubernetes-sigs/image-builder 46 [image-builder-aws]: https://github.com/kubernetes-sigs/image-builder/tree/master/images/capi/packer/ami 47 [aws-capi-images]: https://image-builder.sigs.k8s.io/capi/providers/aws.html 48 [upgrading-workload-clusters]: https://cluster-api.sigs.k8s.io/tasks/kubeadm-control-plane.html#upgrading-workload-clusters 49