Overview
Kubernetes is a powerful container orchestration tool that enables users to reliably deploy and run containerized applications on a scalable system. Within the container area, k8s has undoubtedly become a community standard for container orchestration and management, and even Docker has announced support for K8s. The fighting in the field of container orchestration has been turned around, and the dust settles, and k8s has been unanimously endorsed by the players including Google, Microsoft, IBM, AWS, Rancher, Redhat, CoreOS, etc.
The rancher container management platform natively supports k8s, making it easy and easy for users to deploy k8s clusters.
However, for Chinese players, because of the Google Mirror warehouse, many times the k8s experience is not smooth. In the previous article ("Rancher-k8s Accelerated Installation Documentation"), we explained how to accelerate deployment kubernetes by modifying the store address. While this approach enables accelerated deployment of kubernetes, many components (network, health check, etc.) will not be able to guarantee timely updates because custom store warehouses cannot be synchronized with the official warehouses in real time. Therefore, in order to solve this problem, we have modified the official catalog template, adding the ability to customize the warehouse address and namespace. This allows us to customize the warehouse with the kubernetes image and its namespace when deploying Kubernetes.
Environment preparation
650) this.width=650; "src=" Https://s1.51cto.com/oss/201710/24/6d49e1cb69daa6566c2fe62f5b963c07.png "title=" 1.png " alt= "6d49e1cb69daa6566c2fe62f5b963c07.png"/>
Pre-installation Preparation (important):
-
Rancher-server:v1.6.11 is now an RC version, and there may be some errors during installation.
-
If this warning occurs, you need to remove all containers and replace the Docker version, Docker chooses 1.12.3
650) this.width=650; "src=" Https://s4.51cto.com/oss/201710/24/8ace31b240bebe95cb916d9c3b25125c.png "title=" 2.png " alt= "8ace31b240bebe95cb916d9c3b25125c.png"/>
-
Configure the Hosts file between the nodes;
-
If it is a cloned host, please check if there is no/var/lib/rancher/state/this folder, if any, delete it;
-
If you have previously installed kubernetes through rancher, execute the command:
Docker Rm-f-V $ (Docker Ps-aq) Docker volume RM $ (Docker volume LS) rm-rf/var/etcd/
-
If you choose Vxlan Network deployment, you need the/etc/hosts file to have: ' native IP localhost ' this line, if not, add;
-
Prohibit Swap:sudo Swapoff–a
(This command is a temporary prohibition, permanent Prohibition of reference https://www.xtplayer.cn/2017/10/3162) (important);
Operating instructions
Start Rancher Server
Run Rancher server with the Docker command and print the startup log;
sudo docker run-d--restart always–name rancher-server-p 8080:8080 rancher/server:v1.6.11-rc3 && sudo docker l Ogs-f Rancher-server
After the container initialization is complete, the web is accessed through the host ip:8080.
650) this.width=650; "src=" Https://s4.51cto.com/oss/201710/24/0a4dfb122288a2c8fd9f9df4f2493e1c.png "title=" 3.png " alt= "0a4dfb122288a2c8fd9f9df4f2493e1c.png"/>
Kubernetes Environmental Management
After logging in to the rancher Web, we should go to the system management to do some basic configuration, because we are here to demonstrate the environment, so save this step.
Go to environment management, prepare to add environment template
650) this.width=650; "src=" Https://s3.51cto.com/oss/201710/24/778b9e2c54366aafd7f550ace53afb45.png "title=" 4.png " alt= "778b9e2c54366aafd7f550ace53afb45.png"/>
Click Add Environment Template,
650) this.width=650; "src=" Https://s5.51cto.com/oss/201710/24/66eb672efc02e093eabfc2a394f73a94.png "title=" 5.png " alt= "66eb672efc02e093eabfc2a394f73a94.png"/>
After clicking Edit Settings, in the popup page, change the following parameters:
Private Warehouse Address: registry.cn-shenzhen.aliyuncs.com
Aaons Component namespaces: RANCHER_CN
Kubernetes-helm namespace: RANCHER_CN
650) this.width=650; "src=" Https://s2.51cto.com/oss/201710/24/4c6c8fa2b10c35a52c7f235b713f1642.png "title=" 6.png " alt= "4c6c8fa2b10c35a52c7f235b713f1642.png"/>
After setting the parameters, click the Settings button at the bottom of the page to return to the Environment template Editing page.
650) this.width=650; "src=" Https://s5.51cto.com/oss/201710/24/f3187eb88ea8f080a014f66773534285.png "title=" 7.png " alt= "F3187eb88ea8f080a014f66773534285.png"/>
To keep the environment template other parameters intact, click the Create button at the bottom of the page.
650) this.width=650; "src=" Https://s3.51cto.com/oss/201710/24/e24ebf0351754188c16df269b98122de.png "title=" 8.png " alt= "E24ebf0351754188c16df269b98122de.png"/>
Back to Environment management, click Add Environment, and then click Create
650) this.width=650; "src=" Https://s1.51cto.com/oss/201710/24/d1e61458f058eceb0ee0340132819951.png "title=" 9.png " alt= "D1e61458f058eceb0ee0340132819951.png"/>
This creates a k8s environment with the template you just created
650) this.width=650; "src=" Https://s2.51cto.com/oss/201710/24/dd115fda5b546a3e499affab55a757c6.png "title=" 10.png "alt=" Dd115fda5b546a3e499affab55a757c6.png "/>
Adding nodes
Switch to the environment you just created
650) this.width=650; "src=" Https://s3.51cto.com/oss/201710/24/b325da71082923a29a3e3f51ec46f4f9.png "title=" 11.png "alt=" B325da71082923a29a3e3f51ec46f4f9.png "/>
Now the status is this, click Add Host,
650) this.width=650; "src=" Https://s4.51cto.com/oss/201710/24/e8fbdc3968179a48a9f7b0e3c01544bc.png "title=" 12.png "alt=" E8fbdc3968179a48a9f7b0e3c01544bc.png "/>
Because it is the first time to add the host, the system will ask you to confirm the node registration address, we directly click Save.
650) this.width=650; "src=" Https://s5.51cto.com/oss/201710/24/4fed902deabd302e1dfeec3508586c83.png "title=" 13.png "alt=" 4fed902deabd302e1dfeec3508586c83.png "/>
Copy code to three node execution
650) this.width=650; "src=" Https://s4.51cto.com/oss/201710/24/b8b1caeabc2dd2d0f86ed076df9d5c86.png "style=" float: none; "title=" 14.png "alt=" B8b1caeabc2dd2d0f86ed076df9d5c86.png "/>
650) this.width=650; "src=" Https://s1.51cto.com/oss/201710/24/e05d8e6649f2336fb872dbe5f888a8f2.png "style=" float: none; "title=" 15.png "alt=" E05d8e6649f2336fb872dbe5f888a8f2.png "/>
Installation Complete:
Instrument panel
650) this.width=650; "src=" Https://s3.51cto.com/oss/201710/24/eca7c77b0b12a820f78fae4279924a8e.png "title=" 16.png "alt=" Eca7c77b0b12a820f78fae4279924a8e.png "/>
Application stack
650) this.width=650; "src=" Https://s5.51cto.com/oss/201710/24/a1b8facb8557a46a316970b1a1cab386.png "title=" 17.png "alt=" A1b8facb8557a46a316970b1a1cab386.png "/>
Host View
650) this.width=650; "src=" Https://s5.51cto.com/oss/201710/24/9feb06a97152749e72c8c87cac5cf9a5.png "title=" 18.png "alt=" 9feb06a97152749e72c8c87cac5cf9a5.png "/>
Access Infrastructure | Container view, uncheck Display System container
650) this.width=650; "src=" Https://s3.51cto.com/oss/201710/24/8764efd638a9faa46c43a06b370fd9f2.png "title=" 19.png "alt=" 8764efd638a9faa46c43a06b370fd9f2.png "/>
Normal state, non-system containers should have 14.
650) this.width=650; "src=" Https://s3.51cto.com/oss/201710/24/80c1f87b8b1b308ac7e23dc2d5e2ffef.png "title=" 20.png "alt=" 80c1f87b8b1b308ac7e23dc2d5e2ffef.png "/>
Deployment Demo Sample
Enter Dashdorad
650) this.width=650; "src=" Https://s1.51cto.com/oss/201710/24/2021d1a8afae61ac97fba5dedff8ebb2.png "title=" 21.png "alt=" 2021d1a8afae61ac97fba5dedff8ebb2.png "/>
In the top right corner of the page, click Create to create a sample service Nginx
650) this.width=650; "src=" Https://s3.51cto.com/oss/201710/24/735483d677292b82eeaf931b4ccb8836.png "title=" 22.png "alt=" 735483d677292b82eeaf931b4ccb8836.png "/>
Click Overview to view:
650) this.width=650; "src=" Https://s3.51cto.com/oss/201710/24/e9690a3eb8e20b81aba2ba5187a764bd.png "title=" 23.png "alt=" E9690a3eb8e20b81aba2ba5187a764bd.png "/>
Click the external portal to access the app:
650) this.width=650; "src=" Https://s5.51cto.com/oss/201710/24/8b3d5ce163fd91c309ecb2e71e011437.png "style=" float: none; "title=" 24.png "alt=" 8b3d5ce163fd91c309ecb2e71e011437.png "/>
650) this.width=650; "src=" Https://s4.51cto.com/oss/201710/24/b43b88215594c950ffaa74fc69335994.png "style=" float: none; "title=" 25.png "alt=" B43b88215594c950ffaa74fc69335994.png "/>
Original source: Rancher Labs
This article is from the "12452495" blog, please be sure to keep this source http://12462495.blog.51cto.com/12452495/1975626
Native accelerated kubernetes installation in China area