preface

Recently, I want to increase the automatic deployment and expansion capacity for the CI system of the company, so I started to try it after looking at Jimmy Song’s Kubernetes-Handbook, just trying to put Kubernetes up for fun. However, it is not easy to deploy Kubernetes manually. If you are not careful, it is difficult to locate errors. It’s no wonder that tools to simplify Kubernetes have sprung up, trying kuberadmin, Vargant and Rancher. Rancher is a cluster scheduling tool with a built-in UI that is much easier to use than native Kubernetes. However, there are some problems, so I would like to share my experience with you here.

What is a Rancher

Rancher is a container cluster orchestration tool. It is based on Docker and has its own GUI, which is easy to deploy and use. It is worth noting that rancher2.0 is entirely kubernetes based while 1.x is compatible with other clusters (MESOS and SWARM). Rancher provides a package of infrastructure services for containers: CNI-compliant network services, storage services, host management, load balancing, protective walls… Rancher enables these services to run across public cloud, private cloud, virtual machine, and physical machine environments, enabling one-click application deployment and management

Rancher deployment process

Now that we’ve covered Rancher briefly, let’s talk about how to deploy Rancher2.0.

1. Deploy the active node

Rancher2.0 is deployed based on Docekr so you need to get your environment ready. Here it isThe website links.

1) Prepare a host (UBubtu 16.04), other versions of the system may have weird problems.

2) Install docker,sudo apt insall docker.io

3) Install rancher,sudo docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher, domestic network this process will be very long, and may fail, failed to try again, really not good to have to learn science to get online

4) After this step succeeds, open your browser and log inhttps://ipCheck for success.



Click advanced to continue to enter you can see the login interface



Next is to set the login password and other work, see the prompt basic no problem.

2; Extended working node

This one is also fairly simple. Click the Edit button in the upper right corner of the cluster page to bring up the image below.



Execute the long list of Docker commands on the computer you want to extend.

3. Deploy the private server of the image library

Using Rancher means that the service must have been mirrored by Docker, which means that Rancher must have a corresponding mirror library.

At present, the mirror library has DockerHub, netease, Ali cloud and other service providers, but DockerHub network speed touching, netease only provides 10 trial amount, more than 10 to apply for verification of the company, the rest is to pay money.

To solve this problem, it is recommended to deploy a private image management tool, the default is Registry, but this is relatively simple, without the concept of permissions and projects. It is recommended to deploy Harbor, vmware products or very easy to use.

Deployment is also relatively simple, I won’t introduce the detailed process here, a bit off topic. seegithub.

A few things to note:

1) Unless HTTPS is deployed, all rancher nodes need to change the docker configuration file, daemon.json to allow HTTP connections from Harbor

2) Private image library is a separate project in Rancher, and the corresponding object library should be configured in each project, as shown in the following figure.



Follow further instructions to enter the account number and password to invoke the private library.

conclusion

1. Rancher is completely docker-based and therefore very easy to install 2. Try to separate the nodes of Rancher and K8S during deployment, otherwise the service will be special. Don’t ask me how I know.