vkhitrin.com

Technology And Ramblings

Adding OpenStack Cloud Provider To Rancher Cluster



Tags: #OpenStack #Rancher #Kubernetes

Note: 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.
Kubernetes cloud provider is a resource that allows you to leverage your cloud infrastructure to supply additional infrastructure resources (storage/network) to your Kubernetes cluster.

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

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 to the 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 a 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

To add an OpenStack cloud provider to the Rancher Kubernetes cluster, add the following section to the cluster definition (refer to the documentation for a complete list of options): Modified cluster YAML

Cluster Update/Creation

After configuring YAML, your cluster will be deployed/updated: Cluster update

Wait until the 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 to utilize OpenStack resources which is out of the 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 the /etc/kubernetes/cloud-config file on Kubernetes nodes and will contain the 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 the storage and network capabilities of the Kubernetes cluster.

By YAML cluster definition, additional cloud providers may be added during/post Rancher Kubernetes cluster deployment.

Back To Top