Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to create K8S Cluster in OpenStack using Rancher

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to use Rancher to create a K8S cluster in OpenStack, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can get something.

Kubernetes itself has been integrated with OpenStack for some time and has established a good foundation. It consists of two components: the OpenStack cloud provider and the OpenStack node driver. In Rancher, cloud providers are available by default, and there are node drivers in Rancher, but this is not provided by default.

There are two ways to build a Rancher Kubernetes cluster on OpenStack: using the OpenStack node driver or through custom node settings (https://rancher.com/docs/rancher/v2.x/en/cluster-provisioning/rke-clusters/custom-nodes/).

For ease of access, you can get all the configuration examples in this article on Github:

Https://github.com/chfrank-cgn/Rancher/tree/master/openstack

Start the OpenStack Cloud provider

To allow Kubernetes access to OpenStack API to create a load balancer or volume, you need to enable the OpenStack cloud provider. To do this, select the "Custom" option when creating a cluster for cloud providers in Rancher GUI, and then insert the following information into the cluster configuration (through "Edit YAML")-- you can replace the actual values as needed:

Rancher_kubernetes_engine_config:... Cloud_provider: name: "openstack" openstackCloudProvider: block_storage: ignore-volume-az: true trust-device-path: false bs-version: "v2" global: auth-url: "https://api.openstack.net:5000/v3" # Keystone Auth URL domain-name:" Default "# Identity v3 Domain Name tenant-id:" 616a8b01b5f94f99acd00a844f8f46c3 "# Project ID username: "user" # OpenStack Username password: "pass" # OpenStack Password load_balancer: lb-version: "v2" subnet-id: "f339e543-a67f-45fa-8157-4a58b0940e0b" floating-network-id: "ca27ca05-2870-47b3-ad2f-535d04c9e736" create-monitor: false manage-security-groups: true monitor-max-retries: 0 use -octavia: true metadata: request-timeout: 0 ignore_docker_version: false...

With this information, Kubernetes will be able to access OpenStack API, create and delete resources, and access Cinder volume and Octavia load balancers. Without this configuration, the Kubernetes cluster works well, but cannot access Cinder or Octavia, or other OpenStack resources.

Method 1: create a cluster using the OpenStack node driver

The node driver needs to be enabled in the Rancher configuration to create a Kubernetes cluster on OpenStack using the built-in node driver. Then you need to create a node template with the following information (you can change the actual value as needed):

AuthUrl: "https://api.openstack.net:5000/v3","availabilityZone":" Zone1 "," domainName ":" Default "," flavorName ":" standard.2.1905 "," floatingipPool ":" extern "," imageName ":" ubuntu-18.04-bionic-amd64 "," keypairName ":" rancher "," netName ":" intern "," sshPort ":" 22 "," sshUser ":" ubuntu "," tenantId ":" 616a8b01b5f94f99acd00a844f8f46c3 "," username ":" user "

After that, like all other cloud providers, cluster creation is very simple.

Security option

The following firewall rules need to be defined between Rancher and OpenStack tenants to enable automatic clustering settings:

Bidirectional ssh, http, and https

2376 (docker) from Rancher to tenant node

2376, 2379, 2380, 6443 and 10250 between tenant nodes

Method 2: create a cluster using custom nodes

You can build a cluster from a separately created instance with the help of a startup script to install and enable docker (on Ubuntu 18.04 TLS):

#! / bin/shapt-get updateapt-get-y install apt-transport-https jq software-properties-commoncurl-fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add- add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release-cs) stable" apt-get updateapt-get-y install docker-ce=18.06.3~ce~3-0~ubuntuusermod-G docker- a ubuntuexit 0 Security item

The following firewall rules need to be defined for OpenStack tenants to allow clusters to be created from existing nodes:

SSH from Workstation

Http and https to Rancher

Access Cinder block storage

In order to access Cinder block storage, the following storage class definitions need to be applied:

ApiVersion: storage.k8s.io/v1kind: StorageClassmetadata: name: cinderprovisioner: kubernetes.io/cinderreclaimPolicy: Deleteparameters: availability: nova

No further action is required to enable the OpenStack load balancer.

Troubleshooting

There will be some errors in the initial setup process, which requires constant trial and error. Rancher itself is a good source of debug information, and its logs are output as standard files. Catching this clue will be of great help to debugging, especially in the process of creating nodes.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report