This is an example showing how to run Kubernetes 1.11+ on Travis-CI using Kubernetes in Docker (KinD
). For more details check the lightning talk I held on KubeCon North America 2018: 'Spawning Kubernetes in CI For Integration Tests'
and the follow up article on Loodse blog.
The recording of the talk is available on YouTube and the slides are available on Sched:
The Travis-CI manifest (.travis.yml
) shows how to build a job for running integration tests, which first runs a local Kubernetes cluster using KinD (as defined in the before_script
stage) and then runs integration tests (as defined in the script
stage).
When running Integration and End-to-End tests, we usually want to build an image for application we test locally. When creating a cluster, KinD runs a Docker container on the host machine (in our case on Travis-CI) which contains dependencies needed for Kubernetes, including Docker, and then runs Kubernetes in that container. For Kubernetes to be able to use images built locally, we need to sideload the image from the host machine to Docker running in the KinD's container, which can be done using the build_images.sh
script.
If you want to learn more about KinD, check out the following resources:
There is a #kind channel on Kubernetes Slack where you can reach out to maintainers and users, and follow the development progress.
If you have any questions regarding KinD and running KinD in CI, feel free to reach out to me over GitHub Issues, Kubernetes Slack (@xmudrii
) or Twitter.