sigs.k8s.io/cluster-api@v1.7.1/docs/book/src/clusterctl/commands/init.md (about) 1 # clusterctl init 2 3 The `clusterctl init` command installs the Cluster API components and transforms the Kubernetes cluster 4 into a management cluster. 5 6 This document provides more detail on how `clusterctl init` works and on the supported options for customizing your 7 management cluster. 8 9 ## Defining the management cluster 10 11 The `clusterctl init` command accepts in input a list of providers to install. 12 13 <aside class="note"> 14 15 <h1> Which providers can I use? </h1> 16 17 You can use the `clusterctl config repositories` command to get a list of supported providers and their repository configuration. 18 19 If the provider of your choice is missing, you can customize the list of supported providers by using the 20 [clusterctl configuration](../configuration.md) file. 21 22 Important! The Cluster API project supports ecosystem growth and extensibility. The `clusterctl` CLI carries a list of 23 predefined providers sponsored by SIG Cluster Lifecycle, and out-of-organization third party open-source repositories. 24 Each repository is the responsibility of the respective maintainers, including their quality standards and support. 25 26 </aside> 27 28 #### Automatically installed providers 29 30 The `clusterctl init` command automatically adds the `cluster-api` core provider, the `kubeadm` bootstrap provider, and 31 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. 32 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: 33 34 `clusterctl init --infrastructure aws` 35 36 <aside class="note warning"> 37 38 <h1> Warning </h1> 39 40 The `cluster-api` core provider, the `kubeadm` bootstrap provider, and the `kubeadm` control-plane provider are automatically installed only if: 41 - The user doesn't explicitly require to install a core/bootstrap/control-plane provider using the `--core` flag, the `--bootstrap` flag or the `--control-plane` flags; 42 - There is not an instance of a CoreProvider already installed in the cluster; 43 44 Please note that the second rule allows to execute `clusterctl init` more times: the first call actually initializes 45 the management cluster, while the subsequent calls can be used to add more providers. 46 47 </aside> 48 49 <aside class="note"> 50 51 <h1> Is it possible to skip automatic install?</h1> 52 53 To skip automatic provider installation use `--bootstrap "-"` or `--control-plane "-"`. 54 Note it is not possible to skip automatic installation of the `cluster-api` core provider. 55 56 </aside> 57 58 #### Provider version 59 60 The `clusterctl init` command by default installs the latest version available 61 for each selected provider. 62 63 <aside class="note"> 64 65 <h1> Is it possible to install a specific version of a provider? </h1> 66 67 You can specify the provider version by appending a version tag to the provider name, e.g. `aws:v0.4.1`. 68 69 Pinning the version provides better control over what clusterctl chooses to install 70 (usually required in an enterprise environment). Version pinning should always be used when using [image overrides](../configuration.md#image-overrides), or when relying on internal repositories with a separated 71 software supply chain, or a custom versioning schema. 72 73 </aside> 74 75 <aside class="note"> 76 77 <h1> Pre-release provider versions </h1> 78 79 `clusterctl init` does not install pre-release versions by default. For 80 example, if a provider has releases `v0.7.0-alpha.0` and `v0.6.6`, the latest 81 release installed will be `v0.6.6`. 82 83 You can specify the provider version by appending a version tag to the 84 provider name, e.g. `vsphere:v0.7.0-alpha.0`. 85 86 </aside> 87 88 #### Target namespace 89 90 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. 91 92 See the provider documentation for more details. 93 94 <aside class="note"> 95 96 <h1> Is it possible to change the target namespace ? </h1> 97 98 You can specify the target namespace by using the `--target-namespace` flag. 99 100 Please, note that the `--target-namespace` flag applies to all the providers to be installed during a `clusterctl init` operation. 101 102 </aside> 103 104 <aside class="note warning"> 105 106 <h1>Warning</h1> 107 108 The `clusterctl init` command forbids users from installing two instances of the *same* provider in the 109 same target namespace. 110 111 </aside> 112 113 ## Provider repositories 114 115 To access provider specific information, such as the components YAML to be used for installing a provider, 116 `clusterctl init` accesses the **provider repositories**, that are well-known places where the release assets for 117 a provider are published. 118 119 Per default `clusterctl` will use a go proxy to detect the available versions to prevent additional 120 API calls to the GitHub API. It is possible to configure the go proxy url using the `GOPROXY` variable as 121 for go itself (defaults to `https://proxy.golang.org`). 122 To immediately fallback to the GitHub client and not use a go proxy, the environment variable could get set to 123 `GOPROXY=off` or `GOPROXY=direct`. 124 If a provider does not follow Go's semantic versioning, `clusterctl` may fail when detecting the correct version. 125 In such cases, disabling the go proxy functionality via `GOPROXY=off` should be considered. 126 127 See [clusterctl configuration](../configuration.md) for more info about provider repository configurations. 128 129 <aside class="note"> 130 131 <h1> Is it possible to override files read from a provider repository? </h1> 132 133 If, for any reasons, the user wants to replace the assets available on a provider repository with a locally available asset, 134 the user is required to save the file under `$XDG_CONFIG_HOME/cluster-api/overrides/<provider-label>/<version>/<file-name.yaml>`. 135 136 ```bash 137 $XDG_CONFIG_HOME/cluster-api/overrides/infrastructure-aws/v0.5.2/infrastructure-components.yaml 138 ``` 139 140 </aside> 141 142 ## Variable substitution 143 Providers can use variables in the components YAML published in the provider's repository. 144 145 During `clusterctl init`, those variables are replaced with environment variables or with variables read from the 146 [clusterctl configuration](../configuration.md). 147 148 <aside class="note warning"> 149 150 <h1> Action Required </h1> 151 152 The user should ensure the variables required by a provider are set in advance. 153 154 </aside> 155 156 <aside class="note"> 157 158 <h1> How can I know which variables a provider requires? </h1> 159 160 Users can refer to the provider documentation for the list of variables to be set or use the 161 `clusterctl generate provider --<provider-type> <provider-name> --describe` command to get a list of expected variable names. 162 163 </aside> 164 165 ## Additional information 166 167 When installing a provider, the `clusterctl init` command executes a set of steps to simplify 168 the lifecycle management of the provider's components. 169 170 * All the provider's components are labeled, so they can be easily identified in 171 subsequent moments of the provider's lifecycle, e.g. upgrades. 172 173 ```bash 174 labels: 175 - clusterctl.cluster.x-k8s.io: "" 176 - cluster.x-k8s.io/provider: "<provider-name>" 177 ``` 178 179 * An additional `Provider` object is created in the target namespace where the provider is installed. 180 This object keeps track of the provider version, and other useful information 181 for the inventory of the providers currently installed in the management cluster. 182 183 <aside class="note warning"> 184 185 <h1>Warning</h1> 186 187 The `clusterctl.cluster.x-k8s.io` labels, the `cluster.x-k8s.io/provider` labels and the `Provider` objects MUST NOT be altered. 188 If this happens, there are no guarantees about the proper functioning of `clusterctl`. 189 190 </aside> 191 192 ## Cert-manager 193 194 Cluster API providers require a cert-manager version supporting the `cert-manager.io/v1` API to be installed in the cluster. 195 196 While doing init, clusterctl checks if there is a version of cert-manager already installed. If not, clusterctl will 197 install a default version (currently cert-manager v1.14.4). See [clusterctl configuration](../configuration.md) for 198 available options to customize this operation. 199 200 <aside class="note warning"> 201 202 <h1>Warning</h1> 203 204 Please note that, if clusterctl installs cert-manager, it will take care of its lifecycle, eventually upgrading it 205 during clusterctl upgrade. Instead, if cert-manager is provided by the users, the user is responsible for 206 upgrading this component when required. 207 208 </aside> 209 210 ## Avoiding GitHub rate limiting 211 212 Follow [this](../overview.md#avoiding-github-rate-limiting)