Google Distributed Cloud supports the OpenStack Kubernetes Cloud provider. Use this feature to automatically provision OpenStack Load Balancing as a Service (LBaaS) resources. Those resources can replace the MetalLB resources to easily expose services running on your Anthos on bare metal clusters to other OpenStack tenants or outside the OpenStack network.
Before you begin
Decide the Anthos clusters that need to use OpenStack LBaaS resources.
Ensure you have access to the machines you are trying to configure.
Learn more about running the cloud-controller-manager in the Kubernetes documentation.
Change your clusters' configuration file
The OpenStack Kubernetes Cloud Provider requires that kubelet
runs on all the
nodes with the following argument:
cloud-provider: "external"
To ensure your Anthos clusters easily meet this requirement, add the
baremetal.cluster.gke.io/external-cloud-provider: "true"
annotation to your
clusters' configuration file under the metadata section before initializing
them.
The entry in your configuration file should look like the following example:
apiVersion: baremetal.cluster.gke.io/v1
kind: Cluster
metadata:
name: cluster1
namespace: cluster-cluster1
annotations:
baremetal.cluster.gke.io/external-cloud-provider: "true"
spec:
..
Some cloud providers on other cloud platforms require a special format for
providerID
, Google Distributed Cloud will generate a providerID
for each
machine. The format is like baremetal://MACHINE_ADDRESS
. If
you want to have a different providerID
, you can specify one for each node
along with the IP address. The configuration will look like:
apiVersion: baremetal.cluster.gke.io/v1
kind: Cluster
metadata:
name: cluster1
namespace: cluster-cluster1
spec:
clusterNetwork:
pods:
cidrBlocks:
- 192.168.0.0/16
services:
cidrBlocks:
- 10.96.0.0/20
controlPlane:
nodePoolSpec:
nodes:
- address: 10.200.0.1
+ providerID: some-prefix://unique-string
- address: 10.200.0.2
+ providerID: some-prefix2://unique-string2
...
---
apiVersion: baremetal.cluster.gke.io/v1
kind: NodePool
metadata:
name: nodepool1
namespace: cluster-admin1
spec:
clusterName: admin1
nodes:
- address: 172.18.0.2
+ providerID: some-prefix3://unique-string3
After you edit the configuration file, use the following command to initialize your cluster:
bmctl create cluster -c cluster1
Now, all nodes in cluster1
run with the required argument: cloud-provider:
"external"
All nodes also have the following fields added to their configuration files:
taints:
- effect: NoSchedule
key: node.cloudprovider.kubernetes.io/uninitialized
value: "true"
These fields are removed after you initialize your cloud provider on this cluster.
kubelet
will run with your provided providerID
if you specified one for
this node.