资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

如何通过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的弹性伸缩
当前链接:http://cdkjz.cn/article/iioppe.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220