1. Introduction:

Istio is one of the star projects in the Service Mesh world, and today we’re going to try out its low-spec Rio. Rio is a new lightweight Service Mesh product from Rancher. Based on LinkerD2, it is quite light. Small as it is, the sparrow has all the functions of IStio. github:github.com/rancher/rio

Since it is a low-configuration version, the low-configuration version of K8S k3S is also selected for the cluster in this paper. The entire environment only needs 2G memory to run, which is much lighter than ISTIO. A 2C4G host can smoothly experience the charm of Service Mesh.

This article focuses on the installation process and then runs a Bookinfo example to implement Canary publishing.

2. Application Version:

  • K3s: 1.0.0
  • Rio: 0.6.0
  • The Rancher: 2.3.3

Before starting, we need to prepare a host with the minimum configuration of 2C4G and install docker

3. Install k3s :(if you already have k8s environment, you can skip this step and directly experience Rio on k8s)

The official installation method is quite simple. Run the following command

curl -sfL https://get.k3s.io | sh -
Copy the code

Rancher’s product usability is quite good, but it is not very friendly to users of domestic networks (* ̄).

Download the K3S installation package

We need Fan Qiang to download the installation package of K3S first, and then install the corresponding release package according to the server architecture type: github.com/rancher/k3s… Most servers are x86, but choose AMD64. Arm64 is the architecture of low-power devices, such as mobile phones

Download tool recommended: Agent: github.com/killgcd/chr… You can also use this tool: Free Download Manager

The installation

Upload the downloaded release package to the /usr/local/bin/directory on the server, name it k3s and run the following command

chmod +x /usr/local/bin/k3s
export INSTALL_K3S_SKIP_DOWNLOAD=true
export INSTALL_K3S_EXEC="server --docker --no-deploy=traefik" 
curl -sfL https://get.k3s.io | sh -
Copy the code

Configuration kubectl

K3s after installed, the cluster configuration file in/etc/rancher/k3s/k3s yaml, put it in. Kube can be accessed through kubectl cluster

cp /etc/rancher/k3s/k3s.yaml   ~/.kube/config

sudo kubectl get nodes Kubectl installation is required
Copy the code

Kubectl download address: docs. The rancher. Cn/rancher2x/I… Download the file, save it to the /usr/local/bin directory, and grant the permission to execute the file

The above k3S single node is installed

4. Rancher2 installation

(This step is not necessary, but since many images during Rio installation are under GCR. IO and cannot be accessed in China, Rancher needs to be installed to intuitively know which images need to be downloaded manually.)

1.Rancher single node installation (either way)

Docker-compose: docker-compose: docker-compose: docker-compose: docker-compose: docker-compose: docker-compose

version: "2.4"
services:
  rancher:
    image: rancher/rancher:latest
    restart: always
    container_name: rancher2
    volumes:
      - /root/deploy/rancher/rancher2:/var/lib/rancher
      - /root/deploy/rancher/log/auditlog:/var/log/auditlog \
    ports:
      - 8443:443
      - 8000:80
Copy the code

To save the above content to/root/deploy/rancher/docker – compose. Yaml then execute the following commands

cd /root/deploy/rancher/
docker-compose build
docker-compose up -d
Copy the code
2. Visit the Rancher

Open your browser: https:// Your server IP :8443/

5. Rancher2 imports the K3S cluster

1. Create a cluster

Click Add Cluster, select Import, enter a cluster name, and click Create

2. Import the K3S cluster


Above are the steps for Rancher to import k3S cluster

6. Rio installation

After such a long preparation, we finally came to the installation of the protagonist Rio today. The official description of Rio installation is fairly simple

$ curl -sfL https://get.rio.io | sh -  
$ rio install
Copy the code
1. The installation package of Rio needs to be downloaded manually due to the same domestic network problem

Download the Rio installation package: github.com/rancher/rio… Select AMD64 to download

Copy the downloaded Rio installation package to the /usr/local/bin/directory and rename it Rio

chmod +x /usr/local/bin/rio Add execute permission to Rio
Copy the code
2. Install the Rio on the K3S cluster
Rio install --ip-address 192.168.3.xx --disable-features build#--ip-address specifies the LAN IP address of your server node. If there is an external IP address, use a comma (,) to separate multiple IP addresses.
In the current Rio version, it is recommended to disable the build function. The build function is used to obtain the image by signature rather than by tag, so there are some problems in downloading the image. Github also has TLS problem when running build function, you can try it if you are interested.
rio -n rio-system pods # Check the deployment
$ rio -a ps # check the process
$ rio info # View Rio details
Copy the code

However, it is also a domestic network problem. The image package of GCR. IO cannot be downloaded, and the deployment schedule will be stuck

3. Check which GCR. IO images cannot be pulled down

Therefore, we need to use Rancher2 to enter the Rancher console, enter k3S cluster, click Namespace Management, and move the two namespaces Linkerd and Rio-system to default

4. Manually download the GCR. IO image

When it comes to downloading gCR. IO images, I can’t help but recommend this project: github.com/zhangguanzh… IO /google_containers/pause:3.1 To pull gcr. IO /google_containers/pause:3.1, run the following command

curl -s https://zhangguanzhang.github.io/bash/pull.sh | bash -s-- GCR. IO/google_containers/pause: 3.1Copy the code

With this artifact, you just need to pull all the failed images on the Rancher and manually pull them once until they all turn green, and there is no problem. Run the following command to check the installation

rio -n rio-system pods # Check the deployment
Copy the code

rio uninstall # to uninstall firstRio install --ip-address 192.168.3.xx --disable-features buildInstall again
Copy the code

Basically, if you see succeeded, you’ve installed Rio successfully, and you’re ready to deploy your application to try it out

Try deploying an Nginx

An Nginx service can be deployed using the Rio run command.

https://github.com/rancher/rio-demo # 80-8080 # Rio run - p due to disable the build function, through the source code package image deployment
rio run -p 80:80 nginx Image deployment can only be downloaded from the image library
rio ps # Check the deployment
Copy the code








7, Rio dashboard

Rio also provides an administrative console

rio dashboard
Copy the code

Never mind the error reported (that is, unable to open the browser on the server), just copy the printed browser address to access. You need to set the administrator account password for the first access.

8, linkerd – web

Rio internally integrates Linkerd2 as the microservice governance framework, so it also provides the management background of Linkerd-Web

# Rio Linkerd # this is the official access command, but there is no documentation for this command
Forwarding from 127.0.0.1:9999 -> 8084
Forwarding from [::1]:9999 -> 8084
Copy the code

Linkerd-web can be accessed through port 9999. Linkerd-web can be accessed through port 9999. Linkerd-web can be accessed through port 9999, but linkerd-Web can be accessed through port 9999. Access to a bird O (╥﹏╥) O because linkerd-Web currently does not have authentication, exposure is not secure, so only local access also said the past. We have to find another way to expose linkerd-Web through the Nginx proxy

Nginx configuration mirror: github.com/greper/rio-… This code has been packaged as an image and uploaded to dockerhub with the image name: xiao5233/ Linkerd-web-nginx :1.1

Deploy the image in the Linkerd namespace, expose any port, and create a service as shown below to expose the Linkerd-Web proxy

http://server IP address :87/





http://server IP address :87/grafana


9, combat, deploy a set of bookinfo play

Open dashboard, click Services, and then click Create

The service name The mirror port
productpage Docker. IO/istio/examples – bookinfo productpage – v1:1.15.0 9080

Then create other services, all with port 9080, without checking Exposed, which are internal services without exposing access addresses

The service name The mirror port
details Docker. IO/istio/examples – bookinfo – details – v1:1.15.0 9080
ratings Docker. IO/istio/examples – bookinfo – ratings – v1:1.15.0 9080
reviews Docker. IO/istio/examples – bookinfo – reviews – v1:1.15.0 9080

rio ps Find the url for productPage and copy it to your browser
Copy the code

You can also go to the Dashboard click service and click on the links in endPoints

10. Canary Release

Next, Reviews will launch the V2 v3 Version of Canary

Now visit ProductPage and the comments section will alternate with different colored stars and no stars for v1

When no problem is found in the v2 v3 version test, you can gradually set the weight of v1 version to 0, and finally log off v1. A new version release is completed

11,

This article describes the installation of K3S, Rancher, and Rio (where Rio disables the build feature), deplores a set of Istio sample applications, Bookinfo, and experiences publishing applications using Rio for Canary

Generally speaking, except for the problem of image download during installation, isTIO is very smooth in other aspects. In terms of resource consumption, ISTIO often loses 8G, while Rio only uses 2G and has low resource consumption, which is suitable for small companies to use. When ISTIO solves the performance problem later, it can also be directly transferred to ISTIO painlessly. Rio is currently in beta and is not recommended for production environments

Well, that’s all for this demo. Thanks for reading.