Instructor: Rafael Bodill
Introduction
Kubernetes is proving great abilities in orchestrating container clusters over large number of nodes with abstract definitions for resources. It allows you to define and manage intricate infrastructure as code.
The goal of the workshop is learning how to natively extend Kubernetes by creating a new custom resource and introducing new abilities to your Kubernetes cluster.
What You Will Build
In the workshop we will create a new Custom Resource Definition (CRD) and define its spec. Together with the operator-sdk and Golang we'll write a Kubernetes controller that watches cluster resource events and create new Job resources that will run Ansible playbooks dynamically when a new custom resource is created.
What You Will Learn
- How to bootstrap a new project using the operator-sdk tool
- How to create and spec a new Kubernetes CRD
- How to use operator-sdk’s development server
- Write a Kubernetes controller that creates new Jobs when new CR's are created
Prerequisites
- Experience with Minikube/Kubernetes
- Basic Golang knowledge
Please ensure you have Virtualbox, Minikube and Go installed on your laptop.
Setuo
- Install Virtualbox
- Install kubectl
- Install Minikube
A Virtualbox Image with the Golang and Minikube has been provided for this workshop should you encounter issues or wish to avoid installations on your laptop. Using the image requires installing Virtualbox on your machine.
For example, in macOS:
brew install go dep kubernetes-cli
brew upgrade go dep kubernetes-cli
brew cask install minikube
brew cask reinstall minikube
minikube start
minikube stop