Published: June 30, 2019
Updated: June 30, 2019
Tags: OpenStack, Rancher, Kubernetes
3 min read

Adding OpenStack Cloud Provider To Rancher Cluster

A follow-up to blog post Deploying Rancher On OpenStack

Tested on Rancher 2.2.4

Rancher Cloud Providers

Rancher cloud providers are similar to Kubernetes cloud providers [1].
Kubernetes cloud provider is a resource that allows to leverage your cloud infrastructure in order to supply additional infrastructure resources (storage/network) to your Kubernetes cluster.

While Kubernetes supports various cloud providers, Rancher Kubernetes Engine supports the following [2]:

  • AWS
  • Azure
  • OpenStack
  • vSphere
  • Custom cloud provider

Adding OpenStack Cloud Provider

As of now, Rancher does not have an option in GUI to configure an OpenStack cloud provider.
Details must be manually added into YAML configuration.

Cloud providers can be added during and after cluster deployment.

An OpenStack cloud provider will allow Kubernetes to access Cinder(block storage) for persistent volumes, Octavia for layer 7 load balancing and Neutron for load balancing.

Cluster Configuration

In cluster configuration, there is an option to view and edit the YAML cluster definition:
Cluster configuration
YAML section will be shown:
Cluter YAML

OpenStack Cloud Provider YAML

A cloud provider is defined by YAML:

# Sample OpenStack cloud provider config
cloud_provider: 
  name: "openstack"
  openstackCloudProvider: 
    block_storage: 
      ignore-volume-az: true
      trust-device-path: false
    global: 
      auth-url: "XXXXX" # Keystone Auth URL
      domain-id: "XXXXX" # Identity v3 domain ID
      tenant-id: "XXXX" # Project ID
      username: "XXXX" # OpenStack Username
      password: "XXXX" # OpenStack Password
    metadata: 
      request-timeout: 0

In order to add an OpenStack cloud provider to Rancher Kubernetes cluster, add the following section to the cluster definition (refer to documentation [3] for full list of options):
Modified cluster YAML

Cluster Update/Creation

After configuring YAML, your cluster will be deployed/updated:
Cluster update
Wait until cluster is deployed/updated:
Rancher Cluster

Verifying OpenStack Cloud Provider

At this point, we only configured Kubernetes to access OpenStack.
Additional configuration must be done in order to utilize OpenStack resources which is out of scope of this blog post.

Node Label

Once an OpenStack cloud provider is set, nodes will receive an additional label failure-domain.beta.kubernetes.io/zone=nova:
Rancher cluster nodes

cloud-config File

Cloud providers are stored in /etc/kubernetes/cloud-config file on Kubernetes nodes and will contain configuration needed by Kubernetes to communicate with OpenStack:

[Global]
auth-url  = XXXX
username  = XXXX
password  = XXXX
tenant-id = XXXX
domain-id = XXXX

[LoadBalancer]

[BlockStorage]
ignore-volume-az = true

[Route]

[Metadata]

Summary

Cloud providers grant additional resources to Kubernetes clusters.

OpenStack is a supported cloud provider that extends storage and network capabilities of Kubernetes cluster.

Additional cloud providers may be added during/post Rancher Kubernetes cluster deployment by YAML cluster definition.


  1. Kubernetes Documentation - Cloud Providers ↩︎

  2. Rancher Documentation - Cloud Providers ↩︎

  3. Rancher Documentation - OpenStack Cloud Provider ↩︎