Rancher 2.0 – K8S is easy

Tram Ho

Preamble

To understand this article you need to have some basic knowledge about K8S, you can refer to the article Learn the basics of Kubernetes – K8s .

Launching a K8S system on a machine is a lot of inconvenience and doesn’t see all the features of the K8S. In reality teams and organizations need a single manipulation and control tool. Rancher 2.0 was born to meet this need. In this article, I would like to introduce the use of Rancher again.

The environment I use will be AWS EC2. This server has a relatively stable network connection with Vietnam and most of all, it has a pay-as-you-go feature that allows you to pay according to usage time in minutes. Very convenient demo without any monthly package rental costs.

What is Rancher?

Rancher helps manage Docker containers by a handy interface, all operations are on the website’s interface. Rancher also integrates some utility tools for System Admin such as Shell, App Catalog … Rancher is a free project, started to develop in 2014. With the initial goal is to develop software to Manage and build containerized system structures in every company, running with all infrastructure architectures. Through many versions, Rancher gradually becomes a tool to support many container orchestration such as: Docker Swarm, Mesos or Kubernetes. Manage resources at AWS EC2, Digital Ocean … with API. Manage intranet connections between containers or the internet.

Cluster Architecture

The model is as follows:

The list of servers that will build:

  • Rancher: 1 server
  • Master: 1 server
  • Node: 2 servers

Prepare the environment

As shown above, we need to prepare:

  • 4 VPSs
  • I choose OS: CentOS 7.4
  • Each server has installed docker

Basic configuration starts Docker

After the installation is complete, we are shown below:

Rancher Install

I use the latest version of Rancher

Login Rancher

Access the Rancher under the path: https: // {IP server install Rancher}

Set up arbitrary Password:

Once the password is set up, the next step is to set up the URL. In this step, the server that installs Rancher needs to provide a public IP, or a public domain. Because when joining the Server to the Cluster, it is necessary to access this server.

Create Cluster

  1. Click the Add Cluster Button
  2. Select Custom
  3. Enter Cluster name.
  4. Click Next

  1. Select checkbox etcd and Control
  2. Copy command and run it on the machine that installs Master
  3. Click Done.

The running process may take some time, you wait until the state of the Cluster is completed, then add the next Node.

Click on the Cluster menu on the menu bar to get the picture as done.

At this point, our Cluster is as follows:

Add Node

  1. Also at mune Cluster, click the icon “3 vertical dots” in the upper right corner, select edit.
  2. Here we click on the checkbox Worker, copy command in the box running on 2 servers for Nodes.
  3. Click Save After the run is complete (the Server has joined the Cluster), we can check it by accessing the Node menu.

If you have full control over your AWS account, an even easier way is to use EC2’s API to create a node through the API key.

Instructions to get Access key: AWS Blog

You can customize the configuration that Rancher will use for your new node: Rancher Document

summary

Instead of using paid K8S management tools like GKE and EKS, the team can use Rancher – a free tool with great features to help us build Kubernetes Cluster quickly. Rancher also provides many useful features for much larger management, in the next article I will share production environment tips.

Share the news now

Source : Viblo