arduino joy_如何用Joy开发Kubernetes应用

arduino joy

Let’s face it: Developing distributed applications is painful.

让我们面对现实:开发分布式应用程序很痛苦。

Microservice architectures might be great for decoupling and scalability but they are intimidatingly complex when it comes to development.

微服务体系结构可能对解耦和可伸缩性非常有用,但在开发方面它们却极其复杂。

Local Kubernetes clusters (Minikube), long build times (Docker), and awkward or even nonexistent solutions to debugging is how we started. Two years in, we have automated everything: nothing runs on my local machine anymore and I can start coding and debugging individual components on any branch in just 15 seconds. 🎉

我们是从本地Kubernetes集群(Minikube),较长的构建时间(Docker)以及笨拙甚至不存在的调试解决方案开始的。 两年以来,我们已实现了一切自动化:不再在本地计算机上运行任何东西,而且我可以在15秒内开始对任何分支上的单个组件进行编码和调试。 🎉

I now enjoy working on our project so much and believe this is one of the most streamlined setups out there. In the following I want to share that experience.

我现在非常喜欢我们的项目,并且相信这是目前最简化的设置之一。 在下文中,我想分享这一经验。

从预览环境开始 (Starting with a Preview Environment)

To get started on a bugfix or feature, I just need to create a new branch on GitHub. This will immediately trigger our CI servers (we use Jenkins) which then deploys a preview application to a GKE cluster. The application lives in a namespace corresponding to the branch name and, using the preview URL, I can access and use the application.

要开始使用错误修正或功能,我只需要在GitHub上创建一个新分支即可。 这将立即触发我们的CI服务器(我们使用Jenkins),然后将预览应用程序部署到GKE集群。 该应用程序位于与分支名称相对应的名称空间中,并且可以使用预览URL访问和使用该应用程序。

Since I only branched off and didn't push any changes, the build artifacts are cached and the deployment takes only a few seconds. But even once I push changes, the build will run quickly as it only rebuilds what is really necessary.

由于我只是分支机构,没有进行任何更改,因此将缓存构建工件,并且部署仅需几秒钟。 但是,即使我推送更改,构建也将快速运行,因为它仅重建真正需要的内容。

开始编码 (Starting to Code)

Next up I spin up a development environment to work on my task. We use Gitpod, which similarly to a CI server prebuilds dev environments for any branch. A click on a button from any of our project’s GitHub pages starts a fresh dev environment for exactly that branch and opens it in my browser.

接下来,我启动了一个开发环境来完成我的任务。 我们使用Gitpod ,它类似于CI服务器为任何分支预先构建开发环境。 在我们项目的GitHub页面的任何一个上单击按钮,即可为该分支完全打开一个全新的dev环境,并在我的浏览器中将其打开。

The dev environment is up after ~15secs and awaits me with a fresh clone of our repo and the correct branch checked out. Furthermore, the project is fully built and even all dependencies are downloaded already. The terminal welcomes me with the following message:

大约15秒后,开发环境就启动了,并等待我们重新克隆我们的repo并签出正确的分支。 此外,该项目已完全构建,甚至所有依赖项都已下载。 终端欢迎我以下消息:

The IDE is preconfigured with all the VS Code extensions we need, in our case Kubernetes, Docker, MySQL, Go and TypeScript. It is also already connected to the Kubernetes cluster running the preview environment as well as the corresponding database. So I can, for example, type 'kubectl get all' in my terminal and see all the deployed kube objects.

IDE已预先配置了我们所需的所有VS Code扩展,例如Kubernetes,Docker,MySQL,Go和TypeScript。 它也已经连接到运行预览环境的Kubernetes集群以及相应的数据库。 因此,例如,我可以在终端中键入“ kubectl get all”并查看所有已部署的kube对象。

The connection is based on a secret token that every developer has to put into their user account once and which is injected when starting a dev environment.

该连接基于一个秘密令牌,每个开发人员都必须将其放入用户帐户一次,并在启动开发环境时将其注入。

Although these ephemeral dev environments run in my browser, they provide all the state-of-the-art tools, allowing me to code, compile, run and debug code as well as interact with the database and the cluster.

尽管这些短暂的dev环境在我的浏览器中运行,但是它们提供了所有最新的工具,使我能够进行代码编写,编译,运行和调试代码以及​​与数据库和集群进行交互。

Of course, I can now push any of my code changes to GitHub and wait for the CI to update my preview environment accordingly. Since the build is caching heavily, small changes are deployed in a minute or so. Most of the time, however, a minute is way too long. We need an instant, hot-reloading experience that allows to debug any service in the context of the full application. Enter Telepresence.

当然,我现在可以将任何代码更改推送到GitHub,然后等待CI相应地更新我的预览环境。 由于构建会大量缓存,因此一分钟左右即可部署少量更改。 但是,大多数情况下,一分钟太长了。 我们需要即时的热重装体验,以便可以在整个应用程序的上下文中调试任何服务。 输入网真

使用网真进行调试 (Debugging with Telepresence)

I want to be able to debug any individual service in the context of the full application. Instead of waiting for redeploys, our components have proper launch configs to debug them using Telepresence.

我希望能够在整个应用程序的上下文中调试任何单个服务。 我们的组件无需等待重新部署,而是拥有适当的启动配置,可以使用Telepresence对其进行调试。

Telepresence replaces a Kubernetes deployment with a proxy that forwards all communication to a locally running process. So in short I can start a local debug session and have it working in the context of my preview environment.

网真用代理将Kubernetes部署替换为代理,该代理将所有通信转发到本地运行的进程。 简而言之,我可以启动本地调试会话,并使其在预览环境中正常工作。

This works fantastically and is the best way I’ve seen so far for debugging Kubernetes services. It allows me to reuse all the existing debugging tools available.

这工作得非常好,是迄今为止到目前为止调试Kubernetes服务的最佳方式。 它允许我重用所有可用的现有调试工具。

推送和审查 (Pushing and Review)

Once I’m happy with my changes, I push to my branch and create a Pull Request. I can do that from within Gitpod which is quite convenient.

对更改感到满意后,我将推送到分支并创建“拉取请求”。 我可以在Gitpod中完成此操作,这非常方便。

Jenkins will now update the preview environment and Gitpod prebuilds a new dev environment. So when a colleague wants to start reviewing my changes, they can try them out immediately and quickly launch a dev environment for deeper inspection. From within Gitpod they can add comments to the code and even approve (or reject) the PR.

Jenkins现在将更新预览环境,而Gitpod将预先构建一个新的开发环境。 因此,当一位同事希望开始查看我的更改时,他们可以立即尝试这些更改并快速启动开发环境以进行更深入的检查。 他们可以从Gitpod内部向代码添加注释,甚至批准(或拒绝)PR。

结论 (Conclusion)

Achieving fast turnarounds and automated setups for distributed applications is hard but an absolute necessity for getting into a productive flow. Any friction in this will have a bad effect on the productivity of your team.

实现分布式应用程序的快速周转和自动设置是困难的,但是绝对需要进入生产流程。 任何摩擦都会对您团队的生产力产生不良影响。

A fast build with preview environments and the slick Telepresence-based debugging experience have been an enjoyable productivity boost for us. If Gitpod didn’t exist we’d have to build it ;).

快速的预览环境构建和出色的基于网真的调试经验为我们带来了令人愉悦的生产力提升。 如果Gitpod不存在,则必须构建它;)。

Do you have questions? Reach out, we are happy to help.

你有问题吗? 伸出援助之手 ,我们很乐意提供帮助。



Note: Some of the features in Telepresence require system calls that are currently only allowed in Gitpod self-hosted.

注意:网真中的某些功能需要系统调用,当前仅在Gitpod自托管中才允许。

翻译自: https://www.freecodecamp.org/news/developing-kubernetes-applications-with-joy/

arduino joy

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/390981.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

怎么样得到平台相关的换行符?

问题:怎么样得到平台相关的换行符? Java里面怎么样得到平台相关的换行符。我不可能到处都用"\n" 回答一 In addition to the line.separator property, if you are using java 1.5 or later and the String.format (or other formatting me…

scrapy常用工具备忘

scrapy常用的命令分为全局和项目两种命令,全局命令就是不需要依靠scrapy项目,可以在全局环境下运行,而项目命令需要在scrapy项目里才能运行。一、全局命令##使用scrapy -h可以看到常用的全局命令 [rootaliyun ~]# scrapy -h Scrapy 1.5.0 - n…

机器学习模型 非线性模型_机器学习:通过预测菲亚特500的价格来观察线性模型的工作原理...

机器学习模型 非线性模型Introduction介绍 In this article, I’d like to speak about linear models by introducing you to a real project that I made. The project that you can find in my Github consists of predicting the prices of fiat 500.在本文中,…

NOIP赛前模拟20171027总结

题目: 1.寿司 给定一个环形的RB串要求经过两两互换后RB分别形成两段连续区域,求最少操作次数(算法时间O(n)) 2.金字塔 给定一个金字塔的侧面图有n层已知每一层的宽度高度均为1要求在图中取出恰好K个互不相交的矩形(边缘可以重叠),求最多可以取…

虚幻引擎 js开发游戏_通过编码3游戏学习虚幻引擎4-5小时免费游戏开发视频课程

虚幻引擎 js开发游戏One of the most widely used game engines is Unreal Engine by Epic Games. On the freeCodeCamp.org YouTube channel, weve published a comprehensive course on how to use Unreal Engine with C to develop games.Epic Games的虚幻引擎是使用最广泛的…

建造者模式什么时候使用?

问题:建造者模式什么时候使用? 建造者模式在现实世界里面的使用例子是什么?它有啥用呢?为啥不直接用工厂模式 回答一 下面是使用这个模式的一些理由和Java的样例代码,但是它是由设计模式的4个人讨论出来的建造者模式…

TP5_学习

2017.10.27:1.index入口跑到public下面去了 2.不能使用 define(BIND_MODULE,Admin);自动生成模块了,网上查了下: \think\Build::module(Admin);//亲测,可用 2017.10.28:1.一直不知道怎么做查询显示和全部显示,原来如此简单&#x…

sql sum语句_SQL Sum语句示例说明

sql sum语句SQL中的Sum语句是什么? (What is the Sum statement in SQL?) This is one of the aggregate functions (as is count, average, max, min, etc.). They are used in a GROUP BY clause as it aggregates data presented by the SELECT FROM WHERE port…

10款中小企业必备的开源免费安全工具

10款中小企业必备的开源免费安全工具 secist2017-05-188共527453人围观 ,发现 7 个不明物体企业安全工具很多企业特别是一些中小型企业在日常生产中,时常会因为时间、预算、人员配比等问题,而大大减少或降低在安全方面的投入。这时候&#xf…

为什么Java里面没有 SortedList

问题:为什么Java里面没有 SortedList Java 里面有SortedSet和SortedMap接口,它们都属于Java的集合框架和提供对元素进行排序的方法 然鹅,在我的认知里Java就没有SortedList这个东西。你只能使用java.util.Collections.sort()去排序一个list…

图片主成分分析后的可视化_主成分分析-可视化

图片主成分分析后的可视化If you have ever taken an online course on Machine Learning, you must have come across Principal Component Analysis for dimensionality reduction, or in simple terms, for compression of data. Guess what, I had taken such courses too …

回溯算法和递归算法_回溯算法:递归和搜索示例说明

回溯算法和递归算法Examples where backtracking can be used to solve puzzles or problems include:回溯可用于解决难题或问题的示例包括: Puzzles such as eight queens puzzle, crosswords, verbal arithmetic, Sudoku [nb 1], and Peg Solitaire. 诸如八个皇后…

C#中的equals()和==

using System;namespace EqualsTest {class EqualsTest{static void Main(string[] args){//值类型int x 1;int y 1;Console.WriteLine(x y);//TrueConsole.WriteLine(x.Equals(y));//True //引用类型A a new A();B b new B();//Console.WriteLine(ab);//报错…

JPA JoinColumn vs mappedBy

问题&#xff1a;JPA JoinColumn vs mappedBy 两者的区别是什么呢 Entity public class Company {OneToMany(cascade CascadeType.ALL , fetch FetchType.LAZY)JoinColumn(name "companyIdRef", referencedColumnName "companyId")private List<B…

TP引用样式表和js文件及验证码

TP引用样式表和js文件及验证码 引入样式表和js文件 <script src"__PUBLIC__/bootstrap/js/jquery-1.11.2.min.js"></script> <script src"__PUBLIC__/bootstrap/js/bootstrap.min.js"></script> <link href"__PUBLIC__/bo…

pytorch深度学习_深度学习和PyTorch的推荐系统实施

pytorch深度学习The recommendation is a simple algorithm that works on the principle of data filtering. The algorithm finds a pattern between two users and recommends or provides additional relevant information to a user in choosing a product or services.该…

什么是JavaScript中的回调函数?

This article gives a brief introduction to the concept and usage of callback functions in the JavaScript programming language.本文简要介绍了JavaScript编程语言中的回调函数的概念和用法。 函数就是对象 (Functions are Objects) The first thing we need to know i…

Java 集合-集合介绍

2017-10-30 00:01:09 一、Java集合的类关系图 二、集合类的概述 集合类出现的原因&#xff1a;面向对象语言对事物的体现都是以对象的形式&#xff0c;所以为了方便对多个对象的操作&#xff0c;Java就提供了集合类。数组和集合类同是容器&#xff0c;有什么不同&#xff1a;数…

为什么Java不允许super.super.method();

问题&#xff1a;为什么Java不允许super.super.method(); 我想出了这个问题&#xff0c;认为这个是很好解决的&#xff08;也不是没有它就不行的&#xff09;如果可以像下面那样写的话&#xff1a; Override public String toString() {return super.super.toString(); }我不…

Exchange 2016部署实施案例篇-04.Ex基础配置篇(下)

上二篇我们对全新部署完成的Exchange Server做了基础的一些配置&#xff0c;今天继续基础配置这个话题。 DAG配置 先决条件 首先在配置DGA之前我们需要确保DAG成员服务器上磁盘的盘符都是一样的&#xff0c;大小建议最好也相同。 其次我们需要确保有一块网卡用于数据复制使用&…