Running Builds Script with Kubernetes
The following are required to run scripts with Kubernetes integration:
- Access to a Kubernetes cluster.
- External storage that is mountable to the Kubernetes cluster.
- Kubectl installed and configured on the machine running the scripts.
All the scripts use a similar formula to launch to Kubernetes:
- The script is run with a valid launch variable in the environment.
- The script then invokes the kubernetes-launch.sh script by sourcing it.
- The launch script then uses the template to generate the appropriate YAML file.
- The generated YAML is then used to launch the object into the specified Kubernetes cluster.
- Once the object is launched the script will end or will do optional tailing of the logs or deletion of the object from the API once Docker container run completes.
The steps to run the script with Kubernetes integration are also similar for all scripts:
- Look at the variables used by the script and by the templates.
- Export the variables that you would like to be different from the defaults in the script, kubernetes-launch-script, and template. Alternatively, you can edit the defaults in the files locally.
- Run the script.
OpenBMC Build
QEMU build
Useful links:
Kubernetes (K8s) is an open source container orchestration system.
If you would like to know more regarding Kubernetes look over these:
Persistent Data Storage
Since Kubernetes works using various nodes to run the builds it is best to use NFS or GlusterFS storage so that data will not be bound to one machine directly. This lets us not care about what node is currently running the container while maintaining access to the data we want.
PVs and PVCs are the way Kubernetes Mounts directories to containers. A script used to launch an NFS mount PV and PVC pair can be found here. There is one caveat to using external storage mounts, the folders used to do the actual build cannot be mounted to an external file system.