Skip to content

Commit b3b1b35

Browse files
authored
Merge pull request #3111 from larainema/docs/clarify-providerid-initialization
📖 Clarify providerID initialization approaches in documentation
2 parents 0f25c9f + a8abcb8 commit b3b1b35

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

docs/book/src/topics/external-cloud-provider.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
44

55
- [External Cloud Provider](#external-cloud-provider)
6+
- [Setting the providerID on nodes](#setting-the-providerid-on-nodes)
7+
- [Option 1: Bootstrap-driven initialization (recommended)](#option-1-bootstrap-driven-initialization-recommended)
8+
- [Option 2: OCCM-driven initialization](#option-2-occm-driven-initialization)
69
- [Steps of using external cloud provider template](#steps-of-using-external-cloud-provider-template)
710

811
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
@@ -12,6 +15,69 @@
1215
All [cluster templates](https://github.com/kubernetes-sigs/cluster-api-provider-openstack/blob/main/templates) are meant to be used with the external cloud provider for OpenStack.
1316
Refer to the [external cloud provider repository](https://github.com/kubernetes/cloud-provider-openstack) or the [helm chart](https://github.com/kubernetes/cloud-provider-openstack/tree/master/charts/openstack-cloud-controller-manager) for more details.
1417

18+
## Setting the providerID on nodes
19+
20+
Kubernetes nodes need a `spec.providerID` for Cluster API to match nodes to
21+
machines. There are two supported approaches for setting it. Both are fully
22+
supported by CAPO.
23+
24+
### Option 1: Bootstrap-driven initialization (recommended)
25+
26+
Set `provider-id` directly via kubelet arguments during node bootstrap using
27+
OpenStack instance metadata exposed through cloud-init. This is what all
28+
default CAPO [cluster templates](https://github.com/kubernetes-sigs/cluster-api-provider-openstack/blob/main/templates) use and what is tested in CI.
29+
30+
```yaml
31+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta2
32+
kind: KubeadmConfigTemplate
33+
spec:
34+
template:
35+
spec:
36+
joinConfiguration:
37+
nodeRegistration:
38+
name: '{{ local_hostname }}'
39+
kubeletExtraArgs:
40+
- name: cloud-provider
41+
value: external
42+
- name: provider-id
43+
value: openstack:///'{{ instance_id }}'
44+
```
45+
46+
With this approach:
47+
48+
- Nodes register with `providerID` already set.
49+
- Machine reconciliation completes without waiting for an external controller.
50+
- OCCM can still be deployed later if cloud features (e.g. LoadBalancer
51+
services, node address management) are needed.
52+
53+
### Option 2: OCCM-driven initialization
54+
55+
Deploy the [OpenStack Cloud Controller Manager](https://github.com/kubernetes/cloud-provider-openstack) (OCCM) after the
56+
control plane is ready. OCCM populates `Node.spec.providerID` for all nodes.
57+
58+
```yaml
59+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta2
60+
kind: KubeadmConfigTemplate
61+
spec:
62+
template:
63+
spec:
64+
joinConfiguration:
65+
nodeRegistration:
66+
name: '{{ local_hostname }}'
67+
kubeletExtraArgs:
68+
- name: cloud-provider
69+
value: external
70+
```
71+
72+
With this approach:
73+
74+
- Nodes register without `providerID`.
75+
- Machine reconciliation waits until OCCM sets the `providerID`.
76+
- OCCM must be deployed for the cluster to fully reconcile.
77+
78+
See [Steps of using external cloud provider template](#steps-of-using-external-cloud-provider-template) below for OCCM
79+
deployment instructions.
80+
1581
## Steps of using external cloud provider template
1682

1783
- After control plane is up and running, retrieve the workload cluster Kubeconfig:

0 commit comments

Comments
 (0)