项目部署时网关怎么回事_使用Kubernetes部署聊天网关(或技术按预期运行时)...
项目部署时网关怎么回事
by Richard Li
理查德·李(Richard Li)
使用Kubernetes部署聊天网关(或技术按预期运行时) (Using Kubernetes to deploy a chat gateway (or when technology works like it’s supposed to))
TL; DR (TL;DR)
This is a story about what happens when cloud technologies work like they’re supposed to. In this case, the technologies are Docker and Kubernetes.
这是一个有关云技术按预期工作时会发生什么的故事。 在这种情况下,技术是Docker和Kubernetes。
介绍 (Introduction)
At Datawire, we use Gitter so that users of our open source tools can chat with us (and each other). We like Gitter because it’s low friction to join, especially if you have a GitHub or Twitter account. However, Gitter’s mobile client isn’t great, and the notifications in general don’t work well.
在Datawire ,我们使用Gitter,以便开放源代码工具的用户可以与我们(以及彼此)聊天。 我们之所以喜欢Gitter是因为加入的摩擦很小,特别是如果您拥有GitHub或Twitter帐户。 但是,Gitter的移动客户端不是很好,并且通知通常不能很好地工作。
Since migrating a community of users is a fair bit of work, I decided to see if I could deploy a bridge between Slack (what we use internally) and our Gitter chat. A little bit of Googling led me to Matterbridge.
由于迁移用户社区是一项相当大的工作,因此我决定看看是否可以在Slack(我们在内部使用)和Gitter聊天之间搭建桥梁。 有点谷歌搜索使我到马特布里奇 。
In the rest of the article, I’ll walk through how Docker and Kubernetes actually made my life easier, and why. I found the amount of yak shaving required to be remarkably small … which made me really appreciate how far we’ve come in the cloud world.
在本文的其余部分,我将逐步介绍Docker和Kubernetes如何使我的生活更轻松,以及为什么。 我发现所需的牛剃须量非常少……这使我非常感谢我们在云计算世界中所取得的成就。
Docker很棒 (Docker is great)
I wanted to run Matterbridge locally to debug the configuration. I followed the general instructions on creating accounts for Slack and Gitter, and then put the necessary authentication tokens into a matterbridge.toml
file.
我想在本地运行Matterbridge来调试配置。 我按照有关为Slack和Gitter创建帐户的一般说明进行操作,然后将必要的身份验证令牌放到matterbridge.toml
文件中。
I was happy to see how Matterbridge is available as a Docker image, so I was able to just copy my configuration file into the Docker image to test out the configuration. All I needed to do was to specify my configuration file when using docker run
:
我很高兴看到Matterbridge如何作为Docker映像提供,因此我能够将配置文件复制到Docker映像中以测试配置。 我需要做的就是在使用docker run
时指定我的配置文件:
docker run -ti -v /tmp/matterbridge.toml:/matterbridge.toml 42wim/matterbridge
I had to make a few turns of this to debug my configuration, but it was quick and easy. The Docker image did exactly what it’s supposed to do: provide a tested runtime environment for Matterbridge so I didn’t have to debug it on my laptop.
我不得不进行一些操作来调试我的配置,但是它既快速又容易。 Docker镜像完全按照预期的方式运行:为Matterbridge提供经过测试的运行时环境,因此我不必在笔记本电脑上对其进行调试。
在云端运行 (Running in the cloud)
The next step was to deploy my configuration to the cloud. We already run a production Kubernetes cluster fronted by an API Gateway powered by Envoy, so I wanted to deploy the service into its own namespace.
下一步是将我的配置部署到云中。 我们已经运行了一个生产的Kubernetes集群,该集群以Envoy为首的API网关为前端,因此我想将服务部署到它自己的名称空间中。
To deploy to Kubernetes, I wrote a simple Dockerfile:
为了部署到Kubernetes,我编写了一个简单的Dockerfile:
FROM 42wim/matterbridge:1.9.0ADD matterbridge.toml .CMD ["/bin/matterbridge"]
Then, all I needed was a Kubernetes manifest.
然后,我只需要一个Kubernetes清单。
Kubernetes (Kubernetes)
In my Kubernetes manifest, I’m able to specify a bunch of key information about the service:
在我的Kubernetes清单中,我可以指定有关该服务的一系列关键信息:
My update strategy,
RollingUpdate
我的更新策略,
RollingUpdate
- The minimum and maximum amount of CPU and memory to allocate要分配的最小和最大CPU和内存量
- The number of replicas of the service服务的副本数
Here is my basic manifest:
这是我的基本清单:
---apiVersion: apps/v1beta1kind: Deploymentmetadata: name: {{build.name}} namespace: {{service.namespace}}spec: replicas: 1 strategy: type: RollingUpdate template: metadata: labels: app: {{build.name}} spec: containers: - name: {{build.name}} image: {{build.images["Dockerfile"]}} imagePullPolicy: IfNotPresent resources: requests: memory: 0.1G cpu: 0.1 limits: memory: {{service.max_memory}} cpu: {{service.max_cpu}}
(Note that I’m using Forge to template and manage the service, so this is a templated Kubernetes manifest).
(请注意,我正在使用Forge来模板化和管理服务,所以这是一个模板化的Kubernetes清单)。
With this manifest, I was able to get my service up and running in Kubernetes.
有了这个清单,我就能在Kubernetes中启动并运行我的服务。
我在Git的Matterbridge服务 (My Matterbridge Service in Git)
In summary, my service consists of:
总而言之,我的服务包括:
- A DockerfileDockerfile
- A (templated) Kubernetes manifest(模板化的)Kubernetes清单
A
matterbridge.toml
configuration filematterbridge.toml
配置文件
all of which I was able to check into a Git repository.
所有这些我都能够检入Git存储库。
前Kubernetes世界 (The pre-Kubernetes world)
The ease with which I was able to get a service reliably made me reflect on how I would have done this in the VM-days. I would’ve had to:
我能够轻松获得可靠的服务使我反思了在VM时代应该如何做到这一点。 我将不得不:
- Provision a VM (and/or create an auto-scaling group)设置VM(和/或创建自动伸缩组)
- Install the necessary runtime dependencies on the VM via some bash script hackery (or use Ansible, or build a custom AMI)通过一些bash脚本黑客在虚拟机上安装必要的运行时依赖项(或使用Ansible或构建自定义AMI)
- Copy my configuration to the VM将我的配置复制到VM
Moreover, if I wanted to make the above reproducible, I would have had to use Terraform, Ansible, CloudFormation, or one of these types of tools. Here is the example from the Terraform documentation on how to create an EC2 instance:
而且,如果我想使上述内容可重复,则必须使用Terraform,Ansible,CloudFormation或这些类型的工具之一。 这是Terraform文档中有关如何创建EC2实例的示例 :
# Create a new instance of the latest Ubuntu 14.04 on an# t2.micro node with an AWS Tag naming it "HelloWorld"provider "aws" { region = "us-west-2"}data "aws_ami" "ubuntu" { most_recent = true filter { name = "name" values = ["ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-*"] } filter { name = "virtualization-type" values = ["hvm"] } owners = ["099720109477"] # Canonical}resource "aws_instance" "web" { ami = "${data.aws_ami.ubuntu.id}" instance_type = "t2.micro" tags { Name = "HelloWorld" }}
As a developer, many of the options above (region, instance type) are things that I don’t really care about. Yet, this is the current abstraction if I want to commit infrastructure-as-code.
作为开发人员,上面的许多选项(区域,实例类型)都是我并不真正关心的事情。 但是,如果要提交基础结构代码,这是当前的抽象。
摘要 (Summary)
Kubernetes is more than just a container scheduler. It really gives you the primitives you need to control how your service gets run, without bogging you down in the details of deployment. We’re definitely embracing the mentality of having a small team of ops folks manage the Kubernetes cluster, while the rest of the development team just manages their services via the Kubernetes primitives.
Kubernetes不仅仅是一个容器调度程序。 它确实为您提供了控制服务运行方式所需的原语,而不会使您陷入部署细节中。 我们确实拥抱有一个小团队OPS的人管理Kubernetes集群的心态,而开发团队的其他成员通过Kubernetes元只是管理他们的服务。
While it’s not always sunshine and roses in Kubernetes-land, in my case of deploying Matterbridge, it was. You’ll have to wait for another article to read about challenges!
虽然在Kubernetes-land并不总是阳光和玫瑰花,但在我部署Matterbridge的情况下却是。 您必须等待另一篇文章来阅读有关挑战的信息!
翻译自: https://www.freecodecamp.org/news/using-kubernetes-to-deploy-a-chat-gateway-or-when-technology-works-like-its-supposed-to-a169a8cd69a3/
项目部署时网关怎么回事
相关文章:

如何用php实现分页效果
分页效果在网页中是常见的,可是怎样才能实现分页呢,今天做了两种方法来实现一下分页的效果 首先,我们需要准备在数据库里面准备一个表,并且插入数据,这些都是必需的前提工作了,不多说,如图所示&…

微信小程序在showToast中换行并且隐藏icon
微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 正文: 实现代码: 注释:真机才有效果,开发工具展示icon属性无效 var a 11\r\n3wx.showToast({title: a,icon:none,duration: 5000})

node aws 内存溢出_如何使用Node.js和AWS快速创建无服务器RESTful API
node aws 内存溢出by Mark Hopson马克霍普森(Mark Hopson) 如何使用Node.js和AWS快速创建无服务器RESTful API (How to quickly create a serverless RESTful API with Node.js and AWS) In this beginner’s guide, we’ll briefly describe the “Serverless” software arc…

java学习之匿名内部类与包装类
匿名内部类: 所谓匿名内部类,顾名思义指的就是定义在类内部的匿名类,现有的spring框架开发以及java图形界面都经常用到匿名内部类。 下面来看一个代码: interface A{public void fun() ; } class B implements A{public void fun(…

【微信小程序】登录功能实现及讲解(获取用户唯一标识)
微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 正文: 功能:登录实现并获取到用户唯一标识 官方文档地址:可以先看完我的文章再看官方地址 实现步骤:1.调用微信API wx.login()得到code 2.把得到的cod…

参考框架 系统 基准_带有基准的前端框架的真实比较(2018更新)
参考框架 系统 基准by Jacek Schae由Jacek Schae 带有基准的前端框架的真实比较(2018更新) (A Real-World Comparison of Front-End Frameworks with Benchmarks (2018 update)) This article is a refresh of A Real-World Comparison of Front-End Frameworks with Benchmar…

U盘重装MacOS-Sierra系统
Mac系统重新安装两种方法: 1、在线远程重装。 2、制作启动U盘进行重装。 理论上第一种比较简单,但是会比较耗时,实际操作中,由于网上下载的系统版本低于我现在MacOS的版本,导致无法安装,因此只能使用第二种…

this和that的区别和原理
微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 正文: 本篇博文纯属个人见解,如有不妥,可以留言批评指正,谢谢。 var that this; this指的是当前的对象。 that是一个临时的变量,用于保存当…

linu逻辑分区动态调整大小
linu逻辑分区动态调整大小 注意: 这个动态调整的方法是有丢数据风险的,要确保调整的源分区没有使用或者使用率很低。源分区中如果有重要的文件最好先备份在centos 6.5上操作过lvdisplay 查看已有的分区的大小 lvdisplay ,选择要操作的逻辑分区&#…

多个敏捷团队同时做一个项目_您说您的团队很敏捷……但是这个词可能并不代表您的想法。...
多个敏捷团队同时做一个项目by Mark Shead由马克希德(Mark Shead) Many things get called Agile — especially by people who are selling something. But the Agile Manifesto makes it clear that it isn’t a methodology. It isn’t a specific way of doing software d…

Python IDLE theme
#转自 http://www.2cto.com/os/201507/418532.html #win10python3.5.2 #保护视力 .idlerc 目录下新建名为 config-highlight.cfg 文件,并加入如下内容 [tango] definition-foreground #fce94ferror-foreground #fa8072string-background #2e3436keyword-foregrou…

【转帖】SQLServer登录连接失败(error:40-无法打开到SQLServer的连接)的解决方案...
在与SQLServer建立连接时出现与网络相关的或特定与实例的错误.未找到或无法访问服务器.请验证实例名称是否正确并且SQL SERVER已配置允许远程链接.(provide:命名管道提供程序,error:40 -无法打开到SQL Server的连接)(Microsoft SQL Server,错误:2) 我刚刚在登录连接SQL Server …

js时间戳转换成日期格式
//时间戳转日期格式function timestampToTime(timestamp) {var date new Date(timestamp * 1000); //时间戳为10位需*1000,时间戳为13位的话不需乘1000Y date.getFullYear() -;M (date.getMonth() 1 < 10 ? 0 (date.getMonth() 1) : date.getMonth() 1)…

30岁找不到工作很绝望_计算机为绝望的新编码员工作方式的快速指南
30岁找不到工作很绝望by Danielle Ormshaw丹妮尔欧姆肖(Danielle Ormshaw) 计算机为绝望的新编码员工作方式的快速指南 (The quick guide to the way computers work for desperate new coders) The sole purpose of your computer is to send and receive information in the…

纯css3代码写下拉菜单效果
1 <!DOCTYPE html>2 <html lang"en">3 <head>4 <meta charset"UTF-8">5 <meta name"viewport" content"widthdevice-width,initial-scale1;user-scaleno">6 <title>CSS3树形菜单</title…

webpack chunkFilename 非入口文件的命名规则 [转]
官网的文档只理解了filename是主入口的文件名,chunkFilename是非主入口的文件名 filename应该比较好理解,就是对应于entry里面生成出来的文件名。比如: {entry: {"index": "pages/index.jsx"},output: {filename: "…

对数组中的数字从小到大排序
微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 var arr [{name:1,age:1},{name:2,age:4},{name:3,age:2} ];function compare(e){return function(a,b){var value1 a[e];var value2 b[e];return value1 - value2;} } console.log(arr.sort(compare…

自动售货机编程_Rosmaro中基于视觉自动机的编程简介
自动售货机编程by Łukasz Makuch通过ŁukaszMakuch Rosmaro中基于视觉自动机的编程简介 (An introduction to visual automata-based programming in Rosmaro) To do automata-based programming is to program with states and transitions. States correspond to different…

JAVA设计模式之命令模式
将请求封装成一个对象,从而使你可以用不同的请求对客户进行参数化;对起那个请求进行排队或记录请求日志。 命令模式告诉我们可以为一个操作生成一个对象并给出它的一个execute(执行)方法。Command模式为系统架构带来效果: 实现请求一方&#…

vb.net与matlab的混合编程
首先,使用deploytool工具或者命令行将matlab的m文件编译成类,结果产生动态链接库.dll文件和一些c#代码的类. 第二步,将这些dll文件导入进去,并使用一些win32api函数,因为此m文件会产生figure窗口,这些api函数将此figure窗口嵌入到vb程序窗体里面. 代码: Imports SystemImports …

java web开发初学_2018年学习Web开发的绝对初学者指南
java web开发初学This post was originally published on Coder-Coder.com.该帖子最初发布在Coder-Coder.com上 。 If you’re a beginner coder, this guide is for you!如果您是初学者,那么本指南适合您! Here is what this guide covers:本指南涵盖…

PC机安装android apk | adb install -r
PC 下载 *****.apk 通过adb直接安装到android系统 转载于:https://www.cnblogs.com/galoishelley/p/4353423.html

微信小程序之apply和call ( 附示例代码和注释讲解) apply call bind
微信小程序开发交流qq群 173683895 相同点:作用是一样的,它们能劫持另外一个对象的方法,继承另外一个对象的属性; js中的call(), apply()和bind()是Function.prototype下的方法,都是用于改变函数运行时上下文&#…

(转)@ContextConfiguration注解说明
场景:学习spring实战中相关的单元测试 1 正常使用 ContextConfiguration Spring整合JUnit4测试时,使用注解引入多个配置文件 1.1 单个文件 ContextConfiguration(locations"../applicationContext.xml") ContextConfiguration(classes Simple…

ios pusher使用_如何使用JavaScript和Pusher构建实时评论功能
ios pusher使用by Rahat Khanna通过拉哈特汉娜 如何使用JavaScript和Pusher构建实时评论功能 (How to build a Live Comment feature using JavaScript and Pusher) These days “Social” has become the buzzword and we all want our apps to be the center of these amazi…

OpenDigg前端开源项目月报201704
由OpenDigg 出品的前端开源项目月报第一期来啦。我们的前端开源月报集合了OpenDigg一个月来新收录的优质前端开源项目,方便前端开发人员便捷的找到自己需要的项目工具。 reactide React web应用开发的第一个专用IDE redux-offline 持久性Redux存储 react-loadable 用…

ubuntu 14.04 使用apt-get出现如下问题解决办法
Some packages could not be installed. This may mean that you haverequested an impossible situation or if you are using the unstabledistribution that some required packages have not yet been createdor been moved out of Incoming. 使用aptitude这个代替apt-get …

java通用象棋游戏_在通用国际象棋界面周围模拟GraphQL包装器
java通用象棋游戏The Universal Chess Interface (UCI) has been around a long time and used by many chess engines. What does GraphQL bring to the mix?通用国际象棋界面(UCI)已经存在了很长时间,并且被许多国际象棋引擎使用。 GraphQL带来了什么?…

表单高级应用和语义化
type"hidde" 隐藏域 disable 禁用 什么是表单语义化 符合W3C规范 语义化的标签 结构合理、代码简洁 分组<fieldset><legend>标题</legend> </fieldsrt> 关联<lable for"id"></lable>转载于:https://www.cnblogs.com/G…

modelsim中一个神奇又容易忽视的问题
最近在用modelsim对设计进行仿真的过程中发现了一个非常有趣的问题。接下来,让我们跟随着一个设计的仿真来发现问题的原因所在。首先,以调用基于IP核的加法器为例。加法器IP核的参数设置如下: 设计代码如下: /*******************…