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.pswp.cn/news/390981.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/390981.shtml
英文地址,請注明出處:http://en.pswp.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;大小建議最好也相同。 其次我們需要確保有一塊網卡用于數據復制使用&…