Skip to content

Commit dcb625e

Browse files
clusterctl more docs
1 parent 4a68ed2 commit dcb625e

File tree

7 files changed

+234
-11
lines changed

7 files changed

+234
-11
lines changed
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
# clusterctl adopt
22

3-
## Pre-requisites
3+
The `clusterctl adopt` command is designed for allowing users to start using clusterctl on management clusters originally
4+
created by installing providers with `kubectl apply <components-yaml>` instead of `clusterctl init`.
5+
6+
The adoption process must be repeated for each provider installed in the cluster, thus allowing clusterctl to re-create
7+
the providers inventory as described in the `clusterctl init` [documentation](init.md#additional-information).
48

5-
### Labels
9+
## Pre-requisites
610

711
In order for `clusterctl adopt` to work, ensure the components are correctly
812
labeled. Please see the [provider contract labels][provider-contract-labels] for reference.
913

1014
<!-- links -->
1115
[provider-contract-labels]: ../provider-contract.md#labels
16+
17+
## Adopting a provider
18+
19+
TODO
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,95 @@
11
# clusterctl config cluster
2+
3+
The `clusterctl config cluster` command returns a YAML template for creating a workload cluster.
4+
5+
For example
6+
7+
```
8+
clusterctl config cluster my-cluster --kubernetes-version v1.16.3 > my-cluster.yaml
9+
```
10+
11+
Creates a YAML file named `my-cluster.yaml` with a predefined list of Cluster API objects; Cluster, Machines,
12+
Machine Deployments, etc. to be deployed in the current namespace (in case, use the `--target-namespace` flag to
13+
specify a different target namespace).
14+
15+
Then, the file can be modified using your editor of choice; when ready, run the following command
16+
to apply the cluster manifest.
17+
18+
```
19+
kubectl apply -f my-cluster.yaml
20+
```
21+
22+
### Selecting the infrastructure provider to use
23+
24+
The `clusterctl config cluster` command uses smart defaults in order to simplify the user experience; in the example above,
25+
it detects that there is only an `aws` infrastructure provider in the current management cluster and so it automatically
26+
selects a cluster template from the `aws` provider's repository.
27+
28+
In case there is more than one infrastructure provider, the following syntax can be used to select which infrastructure
29+
provider to use for the workload cluster:
30+
31+
```
32+
clusterctl config cluster my-cluster --kubernetes-version v1.16.3 \
33+
--infrastructure:aws > my-cluster.yaml
34+
```
35+
36+
or
37+
38+
```
39+
clusterctl config cluster my-cluster --kubernetes-version v1.16.3 \
40+
--infrastructure:aws:v0.4.1 > my-cluster.yaml
41+
```
42+
43+
### Flavors
44+
45+
The infrastructure provider authors can provide different type of cluster templates, or flavors; use the `--flavor` flag
46+
to specify which flavor to use; e.g.
47+
48+
```
49+
clusterctl config cluster my-cluster --kubernetes-version v1.16.3 \
50+
--flavor high-availabilty > my-cluster.yaml
51+
```
52+
53+
Please refer to the providers documentation for more info about available flavors.
54+
55+
### Alternative source for cluster templates
56+
57+
clusterctl uses the provider's repository as a primary source for cluster templates; the following alternative sources
58+
for cluster templates can be used as well:
59+
60+
#### ConfigMaps
61+
62+
Use the `--from-config-map` flag to read cluster templates stored in a Kubernetes ConfigMap; e.g.
63+
64+
```
65+
clusterctl config cluster my-cluster --kubernetes-version v1.16.3 \
66+
--from-config-map my-templates > my-cluster.yaml
67+
```
68+
69+
#### GitHub or local file system folder
70+
71+
Use the `--from` flag to read cluster templates stored in a GitHub repository or in a local file system folder; e.g.
72+
73+
```
74+
clusterctl config cluster my-cluster --kubernetes-version v1.16.3 \
75+
--from https://github.com/my-org/my-repository/blob/master/my-template.yaml > my-cluster.yaml
76+
```
77+
78+
or
79+
80+
```
81+
clusterctl config cluster my-cluster --kubernetes-version v1.16.3 \
82+
--from ~/my-template.yaml > my-cluster.yaml
83+
```
84+
85+
### Variables
86+
87+
If the selected cluster template expects some environment variables, user should ensure those variables are set in advance.
88+
89+
e.g. if the `AWS_CREDENTIALS` variable is expected for a cluster template targeting the `aws` infrastructure, you
90+
should ensure the corresponding environment variable to be set before executing `clusterctl config cluster`.
91+
92+
Please refer to the providers documentation for more info about the required variables or use the
93+
`clusterctl config cluster --list-variables` flag to get a list of variables names required by a cluster template.
94+
95+
The [clusterctl configuration](configuration.md) file can be used as alternative to environment variables.

docs/book/src/clusterctl/commands/move.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,29 @@ The `Cluster` object created in the target management cluster instead will be ac
3535
process completes.
3636

3737
</aside>
38+
39+
## Pivot
40+
41+
Pivoting is a process for moving the provider components and declared Cluster API resources from a source management
42+
cluster to a target management cluster.
43+
44+
This can now achieved with the following procedure:
45+
46+
1. Use `clusterctl init` to install the provider components into the target management cluster
47+
2. Use `clusterctl move` to move the cluster-api resources from a Source Management cluster to a Target Management cluster
48+
49+
## Bootstrap & Pivot
50+
51+
The pivot process can be bounded with the creation of a temporary bootstrap cluster
52+
used to provision a target Management cluster.
53+
54+
This can now achieved with the following procedure:
55+
56+
1. Create a temporary bootstrap cluster, e.g. using Kind or Minikube
57+
2. Use `clusterctl init` to install the provider components
58+
3. Use `clusterctl config cluster ... | kubectl apply -f -` to provision a target management cluster
59+
4. Wait for the target management cluster to be up and running
60+
5. Get the kubeconfig for the new target management cluster
61+
6. Use `clusterctl init` with the new cluster's kubeconfig to install the provider components
62+
7. Use `clusterctl move` to move the Cluster API resources from the bootstrap cluster to the target management cluster
63+
8. Delete the bootstrap cluster
Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,74 @@
1-
# clusterctl
1+
# clusterctl upgrade
2+
3+
The `clusterctl upgrade` command can be used to upgrade the version of the Cluster API providers (CRDs, controllers)
4+
installed into a management cluster.
5+
6+
## Background info: management groups
7+
8+
The upgrade procedure is designed to ensure all the provider in a *management group* will be using the same
9+
Cluster API - API version.
10+
11+
A management group is a group of providers composed by a CoreProvider and a set of Bootstrap/ControlPlane/Infrastructure
12+
providers watching objects in the same namespace.
13+
14+
Usually, in a management cluster there is only a management group, but in case of [n-core multi tenancy](init.md#multi-tenancy)
15+
there can be more than one.
16+
17+
# upgrade plan
18+
19+
The `clusterctl upgrade plan` command can be used to identify possible targets for upgrades.
20+
21+
22+
```shell
23+
clusterctl upgrade plan
24+
```
25+
26+
Produces an output similar to this:
27+
28+
```shell
29+
Checking new release availability...
30+
31+
Management group: capi-system/cluster-api, latest release available for the v1alpha3 Cluster API version:
32+
33+
NAME NAMESPACE TYPE CURRENT VERSION TARGET VERSION
34+
kubeadm-bootstrap capi-kubeadm-bootstrap-system BootstrapProvider v0.3.0 v0.3.1
35+
cluster-api capi-system CoreProvider v0.3.0 v0.3.1
36+
docker capd-system InfrastructureProvider v0.3.0 v0.3.1
37+
38+
39+
You can now apply the upgrade by executing the following command:
40+
41+
upgrade apply --management-group capi-system/cluster-api --cluster-api-version v1alpha3
42+
```
43+
44+
The output contains the latest release available for each management group in the cluster/for each Cluster API / API version
45+
available at the moment.
46+
47+
# upgrade apply
48+
49+
After choosing the desired option for the upgrade, you can run the provided command.
50+
51+
```shell
52+
upgrade apply --management-group capi-system/cluster-api --cluster-api-version v1alpha3
53+
```
54+
55+
The upgrade process is composed by two steps:
56+
57+
* Delete the current version of the provider components, while preserving the namespace where the provider components
58+
are hosted and the provider's CRDs.
59+
* Install the new version of the provider components.
60+
61+
Please note that clusterctl does not upgrade Cluster API objects (Clusters, MachineDeployments, Machine etc.); upgrading
62+
such objects are the responsibility of the provider's controllers.
63+
64+
65+
<aside class="note warning">
66+
67+
<h1>Warning!</h1>
68+
69+
The current implementation of the upgrade process does not preserve controllers flags that are not set through the
70+
components YAML/at the installation time.
71+
72+
User is required to re-apply flag values after the upgrade completes.
73+
74+
</aside>

docs/book/src/clusterctl/configuration.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ providers:
2929
type: "CoreProvider"
3030
```
3131
32+
See [provider contract](provider-contract.md) for instructions about how to set up a provider repository.
33+
3234
## Variables
3335
3436
When installing a provider `clusterctl` reads a YAML file that is published in the provider repository; while executing

docs/book/src/clusterctl/overview.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,14 @@ See the [Minikube documentation](https://minikube.sigs.k8s.io/) for more details
5656
{{#/tab }}
5757
{{#tab Production}}
5858

59-
{{#tabs name:"tab-create-production-cluster" tabs:"Pre-Existing cluster,Pivot"}}
59+
{{#tabs name:"tab-create-production-cluster" tabs:"Pre-Existing cluster"}}
6060
{{#tab Pre-Existing cluster}}
6161

6262
For production use-cases a "real" kubernetes cluster should be used with appropriate backup and DR policies and procedures in place.
6363

6464
```bash
6565
export KUBECONFIG=<...>
6666
```
67-
{{#/tab }}
68-
{{#tab Pivot}}
69-
70-
- Create a bootstrap management cluster with kind/Minikube
71-
- Use `clusterctl init` and `clusterctl config cluster` to create a production cluster (see below)
72-
- "Pivot" the bootstrap management cluster into the production management cluster
73-
7467
{{#/tab }}
7568
{{#/tabs }}
7669

@@ -224,6 +217,9 @@ it detects that there is only an `aws` infrastructure provider and so it uses th
224217
The `clusterctl config cluster` uses cluster templates which are provided by the infrastructure providers.
225218
See the provider's documentation for more information.
226219

220+
See [`clusterctl config cluster`](commands/config-cluster.md) for details about how to use alternative sources
221+
for cluster templates.
222+
227223
</aside>
228224

229225
<aside class="note warning">
@@ -233,6 +229,9 @@ See the provider's documentation for more information.
233229
If the cluster template defined by the infrastructure provider expects some environment variables, user
234230
should ensure those variables are set in advance.
235231

232+
See [`clusterctl config cluster`](commands/config-cluster.md) for details about how to discover the list of
233+
variables required by a cluster templates.
234+
236235
</aside>
237236

238237
For example

docs/book/src/clusterctl/provider-contract.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,27 @@ It is possible to customize the list of providers for `clusterctl` by changing t
3434

3535
</aside>
3636

37+
#### Creating a provider repository on GitHub
38+
39+
You can use GitHub release to package your provider artifacts for other people to use.
40+
41+
A github release can be used as a provider repository if:
42+
43+
* The release tag is a valid semantic version number
44+
* The components YAML, the metadata YAML and eventually the workload cluster templates are include into the release assets.
45+
46+
See the [GitHub help](https://help.github.com/en/github/administering-a-repository/creating-releases) for more information
47+
about how to create a release.
48+
49+
#### Creating a local provider repository
50+
51+
clusterctl supports reading from a repository defined on the local file system.
52+
53+
A local repository can be defined by creating a `<provider-name>` folder with a `<version>` sub-folder for each hosted release;
54+
the sub-folder name MUST be a valid semantic version number.
55+
56+
Each version sub-folder MUST contain the corresponding components YAML, the metadata YAML and eventually the workload cluster templates.
57+
3758
### Metadata YAML
3859

3960
The provider is required to generate a **metadata YAML** file and publish it to the provider's repository.

0 commit comments

Comments
 (0)