如何通过Rancherwebhook微服务实现Service/Host的弹性伸缩

如何通过Rancher webhook微服务实现Service/Host的弹性伸缩,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。

成都创新互联主要从事网站制作、成都网站建设、网页设计、企业做网站、公司建网站等业务。立足成都服务冠县,十载网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:18982081108

概述

这里介绍如何通过Rancher的webhook微服务来实现Service/Host的弹性伸缩。

流程介绍

  • Service Scale

    • 创建example服务对象。

    • 创建service scale webhook对象。

    • 第三方触发webhook,完成service弹性伸缩。

  • Host Sacle

    • 通过阿里云machine driver创建实例对象,打上scale-up标签。

    • 创建host scale webhook对象。

    • 第三方触发webhook,完成host弹性伸缩。

webhook介绍

Rancher webhook的服务流程大致如下:

  1. Webhook Driver(WD)初始化。

  2. Router Handler(RH)初始化。

  3. 接收请求URL和Method,匹配调用RH.Execute或其他方法,RH.Execute解析请求数据得到WD_Id,进而执行WD.Execute,最后返回并response。

如何通过Rancher webhook微服务实现Service/Host的弹性伸缩

环境准备

Platform

  • Mac,Windows,Linux,Docker Cloud,AWS,Azure均可部署。

如何通过Rancher webhook微服务实现Service/Host的弹性伸缩

  • 本次准备的平台是Ubuntu发行版(14.04),为了兼容docker,选择linux发行版的时候内核需控制在3.10以上。

Docker

根据用户选择的平台安装docker引擎,安装指导可参考https://docs.docker.com官方文档,搭配Rancher使用,docker引擎版本最优选择1.12.6或者1.13.1。 本次准备的docker引擎版本是1.12.6。

Rancher

如何通过Rancher webhook微服务实现Service/Host的弹性伸缩

实践步骤

Service Scale

创建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:\n  NGX:\n    image: nginx:alpine\n    stdin_open: true\n    tty: true\n    cpuset: \"0\"\n    ports:\n    - 8787:80/tcp\n    cpu_shares: 1024\n    labels:\n      io.rancher.container.pull_image: always\n      servicename: nginx",
"rancherCompose": "version: '2'\nservices:\n  NGX:\n    scale: 1\n    start_on_create: true",
"binding": null,
"startOnCreate": true
}' 'http://a.b.c.d:8080/v2-beta/projects/1a5/stacks'

如何通过Rancher webhook微服务实现Service/Host的弹性伸缩

创建webhook

如何通过Rancher webhook微服务实现Service/Host的弹性伸缩

Trigger webhook

如何通过Rancher webhook微服务实现Service/Host的弹性伸缩 如何通过Rancher webhook微服务实现Service/Host的弹性伸缩 如何通过Rancher webhook微服务实现Service/Host的弹性伸缩

Host Scale

创建example host

如何通过Rancher webhook微服务实现Service/Host的弹性伸缩 如何通过Rancher webhook微服务实现Service/Host的弹性伸缩

创建webhook

如何通过Rancher webhook微服务实现Service/Host的弹性伸缩

Trigger webhook

如何通过Rancher webhook微服务实现Service/Host的弹性伸缩 如何通过Rancher webhook微服务实现Service/Host的弹性伸缩 如何通过Rancher webhook微服务实现Service/Host的弹性伸缩

看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注创新互联行业资讯频道,感谢您对创新互联的支持。

文章题目:如何通过Rancherwebhook微服务实现Service/Host的弹性伸缩
文章路径:https://www.cdcxhl.com/article34/iioppe.html

成都网站建设公司_创新互联,为您提供移动网站建设外贸网站建设全网营销推广App设计域名注册标签优化

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

营销型网站建设