EKS: Baking AMI (pre-pulling container images before instance boot) #2023
awoimbee
started this conversation in
Show and tell
Replies: 2 comments
-
Thank you for sharing this! |
Beta Was this translation helpful? Give feedback.
0 replies
-
Dear @awoimbee... |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I wanted to share small elements of my journey trying to bake a bottlerocket AMI. I'm posting here because I didn't find any "prior art", if you have a better way, please share !
From my experience, with bottlerocket you're better off using an EBS snapshot of /dev/xvdb rather than using an AMI.
I'm using EKS 1.22, these steps will likely differ in EKS 1.23 (because of dockershim deprecation).Bottlerocket version: v1.6.XEDIT: we're now in 2025 (EKS 1.31) and I'm basically still doing the same thing.
The user-data for the ami builder (the instance you'll launch, snapshot the EBS volume, then shutdown):
Launch the instance. Once you're ssh'ed into the admin container, here's how to interact with the local container registry used by kubelet:
sudo sheltie ctr -a /run/dockershim.sock -n k8s.io i ls
.Here's how to pull from a private ECR repo:
Once you're done, get the volume id of the device
/dev/xvdb
usingaws ec2 describe-instances
. Then shutdown the instance and useaws ec2 create-snapshot
. You now have an EBS snapshot of the/dev/xvdb
device (the one that contains the container images used by bottlerocket) ! Update your EKS worker node lanch template to add something like:Beta Was this translation helpful? Give feedback.
All reactions