In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to use Rancher to deploy K8S clusters in Kubernetes. Xiaobian thinks it is quite practical, so share it with you. I hope you can gain something after reading this article. Let's not say much. Let's take a look at it together with Xiaobian.
1. Install Rancher
Here we use three machines to build a Kubernetes cluster
K8S-M 172.168.0.128
K8S-S1 172.168.0.129
K8S-S2 172.168.0.130
There are 2 different labels in the current version of Rancher Server. For each major release tag, we provide the corresponding version of the document.
rancher/server:latest This tag is the most recently developed build. These builds have been automatically validated and tested by the CI framework. However, these releases do not mean that they can be deployed in production environments.
rancher/server:stable This tag is the latest in a stable release build. This label represents the version recommended for use in a production environment.
PS: Please do not use any release with the prefix rc{n}. These builds are all test builds by the Rancher team.
Here Cenos 7.4 is used, Docker-17.03.2-ce is installed, and stable Rancher-v1.6.14 is pulled.
PS: Docker versions supported by Kubernets 1.11.2 to 1.13.1 and 17.03.2
docker pull rancher/server:v1.6.14
A single instance of Rancher can be started with a simple command.
> docker run -d --restart=unless-stopped -p 8080:8080 rancher/server:v1.6.14
Close the firewall (the firewall needs to be closed for subsequent node addition and master node port communication)
> systemctl stop firewalld.service #close firewall> systemctl disable firewall d.service #disable firewall startup
Wait for the container to start accessing the address of port 8080 corresponding to IP. You can see the following interface
Language can be edited and switched to Simplified Chinese through the lower right corner
2 Plug-in database directory (on demand)
In Rancher Server containers, if you want to use a volume on a host to persist the database, the following command mounts MySQL data volumes when starting Rancher:
> docker run -d -v /usr/local/rancher_mysql:/var/lib/mysql --restart=unless-stopped -p 8080:8080 rancher/server:stable
With this command, the database is persisted on the host. If you have an existing Rancher Server container and would like to host MySQL volumes, you can refer to the official Rancher upgrade instructions.
Rancher uses external databases
Instead of using an internal database, you can start a Rancher Server and use an external database. The startup command is the same as before, but with some additional parameters to specify how to connect to your external database.
Note: In your external database, you only need to create the database name and database user in advance. Rancher automatically creates the database tables that Rancher needs.
The following are examples of SQL commands to create databases and database users
> CREATE DATABASE IF NOT EXISTS cattle COLLATE = 'utf8_general_ci' CHARACTER SET = 'utf8';> GRANT ALL ON cattle.* TO 'cattle'@'%' IDENTIFIED BY 'cattle';> GRANT ALL ON cattle.* TO 'cattle'@'localhost' IDENTIFIED BY 'cattle';
To start a Rancher connection to an external database, you need to add extra parameters to the command that starts the container.
docker run -d --restart=unless-stopped -p 8080:8080 rancher/server \ --db-host myhost.example.com--db-port 3306 --db-user username --db-pass password --db-name battle 3 Permission management
The little friends of the mechanism have noticed that now login to Rancher does not require any username and password, and Rancher's user system needs to be opened by itself.
There are many ways to summarize certification
The most convenient way is to open a local account authentication
After filling in the relevant user name and password to open the local authentication, the next login needs to verify the user, and in the subsequent management can also carry out permission control
4 Rancher Multi-Node HA Deployment
Running Rancher Server in HA mode is as simple as running Rancher Server with an external database, exposing an extra port, adding extra parameters to the startup command, and running an external Load Balancer.
HA deployment requirements
HA node:
For RHEL/CentOS, the default storage driver, such as devicemapper using loopback, is not recommended by Docker. Please refer to Docker documentation for modifications to use other storage drivers.
For RHEL/CentOS, if you want to use SELinux, you need to install additional SELinux components.
All modern Linux distributions RancherOS, Ubuntu, RHEL/CentOS 7 installed with supported Docker versions have been rigorously tested.
Ports 9345, 8080 need to be accessible between nodes
1 GB of memory
MySQL database
Option 1: Run Antelope with default COMPACT options
Option 2: Run MySQL 5.7 using Barracuda. Default ROW_FORMAT needs to be set to Dynamic
At least 1 GB of memory
Each Rancher Server node requires 50 connections (e.g. a 3-node Rancher requires at least 150 connections)
MYSQL configuration requirements
External Load Balancer Server
The Load Balancer Server needs access to port 8080 of the Rancher Server node
Note: Docker for Mac is currently not supported in Rancher.
5. Mass deployment recommendations
Each Rancher Server node requires 4 GB or 8 GB of heap space, which means 8 GB or 16 GB of memory.
MySQL databases require high-performance disks
For a complete HA, it is recommended to use a MySQL database with a duplicate. Another option is to use Galera clustering and force writing to a MySQL node.
On each node that needs to join the Rancher Server HA cluster, run the following command:
# Launch on each node in your HA cluster> docker run -d --restart=unless-stopped -p 8080:8080 -p 9345:9345 rancher/server \ --db-host myhost.example.com --db-port 3306 --db-user username --db-pass password --db-name cattle \ --advertise-address
On each node, it needs to be unique on each node because this IP is added to the HA settings. If you modify-p 8080:8080 and expose a different port on host, you need to add the--advertise-http-port argument to the command.
Note: You can use docker run rancher/server --help to get help with commands.
RANCHER SERVER NODE IN HA MODE
If the IP on your Rancher Server node is modified, your node will no longer exist in the Rancher HA cluster. You must stop the Rancher Server container configured with the incorrect IP at--advertise-address and start a Rancher Server container with the correct IP address.
The above is how to use Rancher to deploy K8S clusters in Kubernetes. Xiaobian believes that some knowledge points may be seen or used in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.