|
3 | 3 | **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* |
4 | 4 |
|
5 | 5 | - [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) |
6 | 9 | - [Steps of using external cloud provider template](#steps-of-using-external-cloud-provider-template) |
7 | 10 |
|
8 | 11 | <!-- END doctoc generated TOC please keep comment here to allow auto update --> |
|
12 | 15 | 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. |
13 | 16 | 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. |
14 | 17 |
|
| 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 | + |
15 | 81 | ## Steps of using external cloud provider template |
16 | 82 |
|
17 | 83 | - After control plane is up and running, retrieve the workload cluster Kubeconfig: |
|
0 commit comments