Deploy the controller-manager in a Kubernetes cluster
- Pushing the docker image to the container registry
- Customizing the deployment manifests
- Applying the manifests to deploy in the clusterKubebuilder generated supports all the above steps.
Prerequisites
Kubebuilder generated Makefile
uses Kustomize for customizing the manifestsbefore deploying to the kubernetes cluster. Follow the to install Kustomize
andensure that is available in the PATH. Note that Kubebuilder requires Kustomize
version 1.0.4
or higher for deploy to work.
Building the docker image and pushing it to a container registry
Makefile
has following targets:
docker-push
to push it to the configured container registry.Both target supportIMG
variable. If IMG argument is not provided, it ispicked from the environment variable.
Customizing the controller manager manifests using Kustomize
Kubebuilder scaffolds a basic under config/default
directory. Current customization:
- Specifies all controller manager resources to be created under specified
namespace
- Adds a prefix (directory name of the project) for controller manager resources
Customizing the controller manager manifests using Kustomize
target in Makefile
generates the base manifests, customizes the base manifests and then applies it to the configured Kubernetes cluster.
By now, you should have controller manager resources deployed in cluster. Youcan examine controller manager pod by running