Since my approach basically comes down to 2 components, an Nginx frontend, and a backend manager for pulling down and mounting the platform archive to somewhere nginx can reach it relative to the iPXE script, Kubernetes offered a pretty straightforward way to do this.
I only needed to create a base Docker image that would contain my iPXE script, and an informational webpage:
FROM nginx
COPY index.html /usr/share/nginx/html/index.html
COPY smartos.ipxe /usr/share/nginx/html/smartos.ipxe
Build and push it to the registry.
The tricky part, and where Kubernetes could be the most help, would be where I pull down the archive, place it on a volume, and then mount it to my above Nginx container. I did this by having an InitContainer pull the archive and decompress it to a volume (I used a hostPath, but since this is not data I wish to persist between schedulings, an emptyDir would suffice as well):
The above has, before my Nginx container is deployed, declared that an InitContainer will run first to extract the archive to the volume, and once that has completed, will proceed to create the Nginx container:
spec:
So, once the InitContainer completes, the archive volume will be mounted to /usr/share/nginx/html/smartos which is where the ipxe script expects the path to the kernel to be.
The last piece is the Kubernetes Service to expose this to the network, so, if you use a provider like Packet (see the above linked pieces for consuming this endpoint) to boot using Custom iPXE, you can boot from this endpoint:
Approaches to using iPXE to boot SmartOS:
Since my approach basically comes down to 2 components, an Nginx frontend, and a backend manager for pulling down and mounting the platform archive to somewhere nginx can reach it relative to the iPXE script, Kubernetes offered a pretty straightforward way to do this.
I only needed to create a base Docker image that would contain my iPXE script, and an informational webpage:
and the Dockerfile to build this image:
Build and push it to the registry.
The tricky part, and where Kubernetes could be the most help, would be where I pull down the archive, place it on a volume, and then mount it to my above Nginx container. I did this by having an InitContainer pull the archive and decompress it to a volume (I used a hostPath, but since this is not data I wish to persist between schedulings, an emptyDir would suffice as well):
The above has, before my Nginx container is deployed, declared that an InitContainer will run first to extract the archive to the volume, and once that has completed, will proceed to create the Nginx container: spec:
So, once the InitContainer completes, the archive volume will be mounted to /usr/share/nginx/html/smartos which is where the ipxe script expects the path to the kernel to be. The last piece is the Kubernetes Service to expose this to the network, so, if you use a provider like Packet (see the above linked pieces for consuming this endpoint) to boot using Custom iPXE, you can boot from this endpoint:
ref - https://medium.com/@jmarhee/using-kubernetes-to-provide-ipxe-infrastructure-for-up-to-date-smartos-platform-897bf4f2cb4