clusterctl init
The clusterctl init command installs the Cluster API components and transforms the Kubernetes cluster
into a management cluster.
This document provides more detail on how clusterctl init works and on the supported options for customizing your
management cluster.
Defining the management cluster
The clusterctl init command accepts in input a list of providers to install.
Automatically installed providers
The clusterctl init command automatically adds the cluster-api core provider, the kubeadm bootstrap provider, and
the kubeadm control-plane provider to the list of providers to install. This allows users to use a concise command syntax for initializing a management cluster.
For example, to get a fully operational management cluster with the aws infrastructure provider, the cluster-api core provider, the kubeadm bootstrap, and the kubeadm control-plane provider, use the command:
clusterctl init --infrastructure aws
Provider version
The clusterctl init command by default installs the latest version available
for each selected provider.
Target namespace
The clusterctl init command by default installs each provider in the default target namespace defined by each provider, e.g. capi-system for the Cluster API core provider.
See the provider documentation for more details.
Watching namespace
The clusterctl init command by default installs each provider configured for watching objects in all namespaces.
Multi-tenancy
Multi-tenancy for Cluster API means a management cluster where multiple instances of the same provider are installed.
The user can achieve multi-tenancy configurations with clusterctl by a combination of:
- Multiple calls to
clusterctl init; - Usage of the
--target-namespaceflag; - Usage of the
--watching-namespaceflag;
The clusterctl command officially supports the following multi-tenancy configurations:
For example:
- Cluster API core provider installed in the
capi-systemnamespace, watching objects in all namespaces; - The kubeadm bootstrap provider in
capbpk-system, watching all namespaces; - The kubeadm control plane provider in
cacpk-system, watching all namespaces; - The
awsinfrastructure provider inaws-system1, watching objects inaws-system1only; - The
awsinfrastructure provider inaws-system2, watching objects inaws-system2only; - etc. (more instances of the
awsprovider)
For example:
- A Cluster API core provider installed in the
capi-system1namespace, watching objects incapi-system1only, and with:- The kubeadm bootstrap provider in
capi-system1, watchingcapi-system1; - The kubeadm control plane provider in
capi-system1, watchingcapi-system1; - The
awsinfrastructure provider incapi-system1, watching objectscapi-system1;
- The kubeadm bootstrap provider in
- A Cluster API core provider installed in the
capi-system2namespace, watching objects incapi-system2only, and with:- The kubeadm bootstrap provider in
capi-system2, watchingcapi-system2; - The kubeadm control plane provider in
capi-system2, watchingcapi-system2; - The
awsinfrastructure provider incapi-system2, watching objectscapi-system2;
- The kubeadm bootstrap provider in
- etc. (more instances of the Cluster API core provider and the dedicated providers)
Provider repositories
To access provider specific information, such as the components YAML to be used for installing a provider,
clusterctl init accesses the provider repositories, that are well-known places where the release assets for
a provider are published.
See clusterctl configuration for more info about provider repository configurations.
Variable substitution
Providers can use variables in the components YAML published in the provider’s repository.
During clusterctl init, those variables are replaced with environment variables or with variables read from the
clusterctl configuration.
Additional information
When installing a provider, the clusterctl init command executes a set of steps to simplify
the lifecycle management of the provider’s components.
- All the provider’s components are labeled, so they can be easily identified in subsequent moments of the provider’s lifecycle, e.g. upgrades.
labels:
- clusterctl.cluster.x-k8s.io: ""
- cluster.x-k8s.io/provider: "<provider-name>"
- An additional
Providerobject is created in the target namespace where the provider is installed. This object keeps track of the provider version, the watching namespace, and other useful information for the inventory of the providers currently installed in the management cluster.