Skip to content

Commit d4184cd

Browse files
committed
Include CABPM and CACPM in the book
1 parent b3b7468 commit d4184cd

File tree

8 files changed

+118
-2
lines changed

8 files changed

+118
-2
lines changed

docs/book/src/SUMMARY.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@
88
- [Certificate Management](./tasks/certs/index.md)
99
- [Using Custom Certificates](./tasks/certs/using-custom-certificates.md)
1010
- [Generating a Kubeconfig](./tasks/certs/generate-kubeconfig.md)
11-
- [Kubeadm based bootstrap](./tasks/kubeadm-bootstrap.md)
11+
- [Bootstrap](./tasks/bootstrap/index.md)
12+
- [Kubeadm based bootstrap](./tasks/bootstrap/kubeadm-bootstrap.md)
13+
- [MicroK8s based bootstrap](./tasks/bootstrap/microk8s-bootstrap.md)
1214
- [Upgrading management and workload clusters](./tasks/upgrading-clusters.md)
1315
- [External etcd](./tasks/external-etcd.md)
1416
- [Using kustomize](./tasks/using-kustomize.md)
1517
- [Upgrading Cluster API components](./tasks/upgrading-cluster-api-versions.md)
16-
- [Kubeadm based control plane management](./tasks/kubeadm-control-plane.md)
18+
- [Control plane management](./tasks/control-plane/index.md)
19+
- [Kubeadm based control plane management](./tasks/control-plane/kubeadm-control-plane.md)
20+
- [MicroK8s based control plane management](./tasks/control-plane/microk8s-control-plane.md)
1721
- [Updating Machine Infrastructure and Bootstrap Templates](tasks/updating-machine-templates.md)
1822
- [Automated Machine management](./tasks/automated-machine-management/index.md)
1923
- [Scaling](./tasks/automated-machine-management/scaling.md)

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,9 @@ providers.
236236
|--------------|--------------------------------------------------------|
237237
|CAPI | cluster.x-k8s.io/provider=cluster-api |
238238
|CABPK | cluster.x-k8s.io/provider=bootstrap-kubeadm |
239+
|CABPM | cluster.x-k8s.io/provider=bootstrap-microk8s |
239240
|CACPK | cluster.x-k8s.io/provider=control-plane-kubeadm |
241+
|CACPM | cluster.x-k8s.io/provider=control-plane-microk8s |
240242
|CACPN | cluster.x-k8s.io/provider=control-plane-nested |
241243
|CAPA | cluster.x-k8s.io/provider=infrastructure-aws |
242244
|CAPB | cluster.x-k8s.io/provider=infrastructure-byoh |
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Bootstrap
2+
3+
This section provides details about bootstrap providers.
File renamed without changes.
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Cluster API bootstrap provider MicroK8s
2+
## What is the Cluster API bootstrap provider MicroK8s?
3+
4+
Cluster API bootstrap provider MicroK8s (CABPM) is a component responsible for generating a cloud-init script to turn a Machine into a Kubernetes Node. This implementation uses [MicroK8s](https://github.com/canonical/microk8s) for Kubernetes bootstrap.
5+
6+
### Resources
7+
8+
* [CABPM Repository](https://github.com/canonical/cluster-api-bootstrap-provider-microk8s)
9+
* [Official MicroK8s site](https://microk8s.io)
10+
11+
## CABPM configuration options
12+
13+
MicroK8s defines a `MicroK8sControlPlane` definition as well as the `MachineDeployment` to configure the control plane and worker nodes respectively. The `MicroK8sControlPlane` is linked in the cluster definition as shown in the following example:
14+
15+
```yaml
16+
apiVersion: cluster.x-k8s.io/v1beta1
17+
kind: Cluster
18+
spec:
19+
controlPlaneRef:
20+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
21+
kind: MicroK8sControlPlane
22+
name: capi-aws-control-plane
23+
```
24+
25+
A control plane manifest section includes the Kubernetes version, the replica number as well as the `MicroK8sConfig`:
26+
27+
```yaml
28+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
29+
kind: MicroK8sControlPlane
30+
spec:
31+
controlPlaneConfig:
32+
initConfiguration:
33+
addons:
34+
- dns
35+
- ingress
36+
replicas: 3
37+
version: v1.23.0
38+
......
39+
```
40+
41+
The worker nodes are configured through the `MachineDeployment` object:
42+
43+
```yaml
44+
apiVersion: cluster.x-k8s.io/v1beta1
45+
kind: MachineDeployment
46+
metadata:
47+
name: capi-aws-md-0
48+
namespace: default
49+
spec:
50+
clusterName: capi-aws
51+
replicas: 2
52+
selector:
53+
matchLabels: null
54+
template:
55+
spec:
56+
clusterName: capi-aws
57+
version: v1.23.0
58+
bootstrap:
59+
configRef:
60+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
61+
kind: MicroK8sConfigTemplate
62+
name: capi-aws-md-0
63+
......
64+
---
65+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
66+
kind: MicroK8sConfigTemplate
67+
metadata:
68+
name: capi-aws-md-0
69+
namespace: default
70+
spec:
71+
template:
72+
spec: {}
73+
```
74+
75+
In both the `MicroK8sControlPlane` and `MicroK8sConfigTemplate` you can set a `MicroK8sConfig` object. In the `MicroK8sControlPlane` case `MicroK8sConfig` is under `MicroK8sConfig.spec.controlPlaneConfig` whereas in `MicroK8sConfigTemplate` it is under `MicroK8sConfigTemplate.spec.template.spec`.
76+
77+
Some of the configuration options available via `MicroK8sConfig` are:
78+
79+
* `MicroK8sConfig.spec.initConfiguration.joinTokenTTLInSecs`: the time-to-live (TTL) of the token used to join nodes, defaults to 10 years.
80+
* `MicroK8sConfig.spec.initConfiguration.httpsProxy`: the https proxy to be used, defaults to none.
81+
* `MicroK8sConfig.spec.initConfiguration.httpProxy`: the http proxy to be used, defaults to none.
82+
* `MicroK8sConfig.spec.initConfiguration.noProxy`: the no-proxy to be used, defaults to none.
83+
* `MicroK8sConfig.spec.initConfiguration.addons`: the list of addons to be enabled, defaults to dns.
84+
* `MicroK8sConfig.spec.clusterConfiguration.portCompatibilityRemap`: option to reuse the security group ports set for kubeadm, defaults to true.
85+
86+
### How does CABPM work?
87+
88+
The main purpose of the MicroK8s bootstrap provider is to translate the users needs to the a number of cloud-init files applicable for each type of cluster nodes. There are three types of cloud-inits:
89+
90+
- The first node cloud-init. That node will be a control plane node and will be the one where the addons are enabled.
91+
- The control plane node cloud-init. The control plane nodes need to join a cluster and contribute to its HA.
92+
- The worker node cloud-init. These nodes join the cluster as workers.
93+
94+
The cloud-init scripts are saved as secrets that then the infrastructure provider uses during the machine creation. For more information on cloud-init options, see [cloud config examples](https://cloudinit.readthedocs.io/en/latest/topics/examples.html).
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Control Plane Management
2+
3+
This section provides details about control plane providers.
File renamed without changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# MicroK8s control plane provider
2+
## What is the Cluster API MicroK8s control plane provider ?
3+
4+
Cluster API MicroK8s control plane provider (CACPM) is a component responsible for managing the control plane of the provisioned clusters. This implementation uses [MicroK8s](https://github.com/canonical/microk8s) for cluster provisioning and management.
5+
6+
Currently the CACPM does not expose any functionality. It serves however the following purposes:
7+
8+
* Sets the ProviderID on the provisioned nodes. MicroK8s will not set the provider ID automatically so the control plane provider identifies the VMs' provider IDs and updates the respective machine objects.
9+
* Updates the machine state.
10+
* Generates and provisions the kubeconfig file used for accessing the cluster. The kubeconfig file is stored as a secret and the user can retrieve via `clusterctl`.

0 commit comments

Comments
 (0)