Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to realize the elastic scaling of Service/Host through Rancher webhook micro-service

Shulou Source: shulou.com Published: 2022-06-01 01:48:22 10月17日 Update

How to achieve the elastic scaling of Service/Host through Rancher webhook micro-services, many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can get something.

Overview

Here is how to achieve the elastic scaling of Service/Host through Rancher's webhook micro-service.

Process introduction

Service Scale

Create an example service object.

Create a service scale webhook object.

A third party triggers webhook to complete service auto scaling.

Host Sacle

Create an instance object through Aliyun machine driver and tag it with scale-up.

Create a host scale webhook object.

A third party triggers webhook to complete host auto scaling.

Webhook introduction

The service flow of Rancher webhook is roughly as follows:

Webhook Driver (WD) initialization.

Router Handler (RH) initialization.

Receive the request URL and Method, match to call RH.Execute or other methods, RH.Execute parses the request data to get WD_Id, then executes WD.Execute, and finally returns and response.

Environment preparation Platform

Mac,Windows,Linux,Docker Cloud,AWS,Azure can be deployed.

The platform to be prepared this time is Ubuntu release (14.04). In order to be compatible with docker, the kernel should be controlled above 3.10 when selecting linux distribution.

Docker

Install the docker engine according to the platform you choose. For installation instructions, please refer to the official https://docs.docker.com documentation and use it with Rancher. The best version of docker engine is 1.12.6 or 1.13.1. The docker engine version to be prepared this time is 1.12.6.

Rancher

Practice step Service Scale

Create example service

Curl-u "xx:xx"\-X POST\-H 'Accept: application/json'\-H' Content-Type: application/json'\-d'{"description": "example service for scaling", "name": "webapp", "system": false "dockerCompose": "version:'2'\ nservices:\ nNGX:\ nimage: nginx:alpine\ nstdin_open: true\ ntty: true\ ncpuset:\" 0\ "\ nports:\ n-8787:80/tcp\ ncpu_shares: 1024\ nlabels:\ nio.rancher.container.pull_image: always\ nservicename: nginx" "rancherCompose": "version:'2'\ nservices:\ nNGX:\ nscale: 1\ nstart_on_create: true", "binding": null, "startOnCreate": true}''http://a.b.c.d:8080/v2-beta/projects/1a5/stacks'

Create webhook

Trigger webhook

Host Scale

Create example host

Create webhook

Trigger webhook

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Tags: Resiliency object engine preparation service selection platform process version third party release help clarity content kernel official instance this data documentation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Shulou Technology Shulou Information Microsoft Apple