Getting Started

This is a getting started guide to demonstrate how to develop a new Cluster API provider.

The guide focus on setting up a new project for implementing the provider and creating:

  • API types and corresponding CustomResourceDefinition (CRD).
  • Webhooks, responsible to default and validate above resources.
  • Controllers, responsible of reconciling above resources.

We will use kubebuilder to create an example infrastructure provider; for more information on kubebuilder and CRDs in general we highly recommend reading the Kubebuilder Book. Much of the information here was adapted directly from it.

Also worth to notice that suggestion in this guide are only intended to help first time provider implementers to get started, but this is not an exhaustive guide of all the intricacies of developing Kubernetes controllers. Please refer to the Kubebuilder Book and to Cluster API videos and tutorials for more information.

If you already know how kubebuilder works, if you know how to write Kubernetes controllers, or if you are planning to use something different than kubebuilder to develop your own Cluster API provider, you can skip this guide entirely.

Prerequisites

tl;dr

# Install kubectl
brew install kubernetes-cli

# Install kustomize
brew install kustomize

# Install Kubebuilder
brew install kubebuilder
# Install kubectl
KUBECTL_VERSION=$(curl -sfL https://dl.k8s.io/release/stable.txt)
curl -fLO https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl

# Install kustomize
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"  | bash
chmod +x ./kustomize && sudo mv ./kustomize /usr/local/bin/kustomize

# Install Kubebuilder
curl -sLo kubebuilder https://go.kubebuilder.io/dl/latest/$(go env GOOS)/$(go env GOARCH)
chmod +x ./kubebuilder && sudo mv ./kubebuilder /usr/local/bin/kubebuilder