Teaches you how to accelerate the deployment of k8s in China and implement custom settings that have a k8s image of the warehouse with its namespace.
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, Huawei, 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
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
- 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;
- Prohibition of Swap:sudo Swapoff–a (this order is a temporary prohibition, permanent Prohibition of reference https://www.xtplayer.cn/2017/10/3162) (important);
- For other precautions, please refer to: https://kubernetes.io/docs/setup/independent/install-kubeadm/;
Operating instructions starting 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.
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
Click Add Environment Template,
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
After setting the parameters, click the Settings button at the bottom of the page to return to the Environment template Editing page.
To keep the environment template other parameters intact, click the Create button at the bottom of the page.
Back to Environment management, click Add Environment, and then click Create
This creates a k8s environment with the template you just created
Adding nodes
Switch to the environment you just created
Now the status is this, click Add Host,
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.
Copy code to three node execution
Installation Complete:
Instrument panel
Application stack
Host View
Access Infrastructure | Container view, uncheck Display System container
Normal state, non-system containers should have 14.
Deployment Demo Sample
Enter Dashdorad
In the top right corner of the page, click Create to create a sample service Nginx
Click Overview to view:
Click the external portal to access the app:
Native rancher accelerates kubernetes installation in China