我如何构建Kubernetes集群,以便我的同事可以更快地部署应用程序

by cheungpat

通过cheungpat

我如何构建Kubernetes集群,以便我的同事可以更快地部署应用程序 (How I built a Kubernetes cluster so my coworkers could deploy apps faster)

How do you encourage your development team to build more projects without being bogged down with deployment? As a company that builds mobile and web products, it’s a priority that we create an environment where our team members focus on building rather than deploying.

您如何鼓励您的开发团队构建更多项目而又不会陷入部署困境? 作为一家构建移动和Web产品的公司,我们首先要创造一个环境,使团队成员专注于构建而不是部署。

But even if we have a deployment platform, we’ll still need someone to manage the administration. As engineers, anything we have to repeat, we want to automate.

但是,即使我们有一个部署平台,我们仍然需要有人来管理管理。 作为工程师,我们必须重复的任何事情都想实现自动化。

What would be a secure way to give our developers access to our deployment platform?

使开发人员能够访问我们的部署平台的安全方法是什么?

  1. We want to allow our developers to build their own projects (perhaps personal) without needing to ask an administrator for permission or resources to deploy a new application for testing or experimenting

    我们希望允许我们的开发人员构建自己的项目(也许是个人的),而无需征求管理员的许可或资源来部署新的应用程序进行测试或试验
  2. Our developers can deploy their own application, update it, or remove it

    我们的开发人员可以部署,更新或删除自己的应用程序
  3. Lower barriers for trying out new things (so to speak)

    降低尝试新事物的门槛(可以这么说)

我们的解决方案:Kubernetes (Our solution: Kubernetes)

Our solution was to use GitHub Authentication for our Kubernetes cluster. For those of you who don’t know, Kubernetes is a production-ready container orchestration engine developed by Google. It’s an open-source platform that enables automation for container operations. Things like deployment and scaling across a cluster of hosts (or nodes).

我们的解决方案是将Kubernetes集群使用GitHub身份验证。 对于不认识的人, Kubernetes是Google开发的可用于生产的容器编排引擎。 这是一个开放源代码平台,可实现容器操作的自动化。 跨主机(或节点)群集进行部署和扩展之类的事情。

With Kubernetes, we are able to support our developers as customers who need to deploy applications and seamlessly roll out new features without a heavy admin overhead. Container technologies are a good practice for packaging backend applications and running them on a server.We run containers from different projects in the same cluster. Kubernetes allows us to focus less on individual servers. We may think of Kubernetes as “a big computer” where our team members can run containers on top of it.

借助Kubernetes,我们可以为需要部署应用程序并无缝推出新功能的客户提供支持,而无需沉重的管理开销。 容器技术是打包后端应用程序并在服务器上运行它们的良好实践。我们在同一集群中运行来自不同项目的容器。 Kubernetes使我们可以减少对单个服务器的关注。 我们可能会将Kubernetes视为“一台大型计算机”,我们的团队成员可以在其中运行容器。

使我们的团队可以访问集群 (Giving our team access to the cluster)

We want colleagues to have their own user credentials to access the cluster. This saves admin time since they don’t need to open a new account for each user. New users can generate the credential themselves, or new ones if they lose their credentials. We were looking for an authentication solution that could meet all of the requirements below:

我们希望同事拥有自己的用户凭据才能访问群集。 由于他们不需要为每个用户开设新帐户,因此节省了管理员时间。 新用户可以自己生成凭据,或者如果丢失凭据则可以生成新凭据。 我们正在寻找一种可以满足以下所有要求的身份验证解决方案:

  1. Admin time should be saved (since they are also our developers)

    应当节省管理员时间(因为他们也是我们的开发人员)
  2. New users can generate their own credentials without needing the admin

    新用户无需管理员即可生成自己的凭据
  3. User credential is always private for security reasons

    出于安全原因,用户凭据始终是私有的
  4. Developers have their own space to experiment

    开发人员有自己的实验空间
  5. Project spaces can be accessed and changed by multiple users

    多个用户可以访问和更改项目空间
  6. In the future, we may want to enable auditing to track changes

    将来,我们可能希望启用审核以跟踪更改

尝试-大多数现有的身份验证策略不适合 (Attempts — most existing authentication strategies do not fit)

First of all, many existing authentication methods still require an admin to generate or manage accounts. This is the main reason we ruled most of them out. Below, I’ll list out some common ones for reference, but feel free to skip to the next section if you just want to understand why we chose GitHub Authentication.

首先,许多现有的身份验证方法仍然需要管理员来生成或管理帐户。 这是我们排除其中大多数的主要原因。 下面,我将列出一些常见的参考,但是如果您只是想了解我们为什么选择GitHub身份验证,请随时跳到下一部分。

基于证书 (Certificate-Based)

Each user has their own private SSL certificate for accessing the cluster, which can be complicated to set up. This means an admin needs to manage a public-key infrastructure (i.e. Certificate Authority) to sign the user certificate. In addition, the admin needs to do this when 1) there is a new user, 2) the certificate expires, or 3) the user has lost the certificate/private-key. Finally, the user has to manage their own private key materials when they want to use the same SSL certs on multiple computers — a potential security weakness.

每个用户都有自己的私有SSL证书来访问群集,这可能会很复杂。 这意味着管理员需要管理公共密钥基础结构(即证书颁发机构)来签署用户证书。 此外,在1)有新用户,2)证书过期或3)用户丢失了证书/私钥时,管理员需要执行此操作。 最后,当用户想在多台计算机上使用相同的SSL证书时,用户必须管理自己的私钥材料,这是潜在的安全漏洞。

基于用户名/密码 (Username/Password-Based)

Since everyone knows how to use a username and password, this is easier to implement than certificate-based authentication. However, Kubernetes doesn’t have a user-friendly interface for our team members to create their own account, which means we still need an admin to generate a set of username and password for each user. Additionally, this means the admin needs to reset a user’s password if the user loses it. Without a user-friendly UI, it is difficult for the user to change the password, too. Kubernetes also requires the API server to be restarted when the username/password list changes.

由于每个人都知道如何使用用户名和密码,因此比基于证书的身份验证更容易实现。 但是,Kubernetes没有一个易于使用的界面供我们的团队成员创建自己的帐户,这意味着我们仍然需要管理员才能为每个用户生成一组用户名和密码。 此外,这意味着如果用户丢失密码,管理员需要重设用户密码。 如果没有用户友好的UI,用户也很难更改密码。 当用户名/密码列表更改时,Kubernetes还要求重新启动API服务器。

预先生成的基于令牌的 (Pre-Generated Token-Based)

Similar to the Username/Password-based approach, the admin is still involved to generate a token. Open ID Connect (OIDC): At the time we built the Kubernetes cluster, OIDC support was not fully-baked, and we were not sure about how to integrate OIDC with Google accounts. OIDC is a good option if it is fully implemented by the Kubernetes API server and client command (this was not implemented last time I checked).

与基于用户名/密码的方法类似,管理员仍需要参与生成令牌。 开放ID连接(OIDC) 在我们构建Kubernetes集群时,OIDC支持还没有完全成熟,并且我们不确定如何将OIDC与Google帐户集成。 如果OIDC由Kubernetes API服务器和客户端命令完全实现(这是我上次检查时未实现),则是一个不错的选择。

使用GitHub身份验证的5个简单原因 (5 simple reasons to use GitHub authentication)

GitHub Authentication was a simple solution because:

GitHub身份验证是一个简单的解决方案,因为:

  1. Everyone in our company already has a GitHub account

    我们公司中的每个人都已经有一个GitHub帐户
  2. This solves our admin overhead problem since people manage their own tokens

    由于人们管理自己的令牌,这解决了我们的管理开销问题
  3. Users can easily generate an access token on github.com

    用户可以在github.com上轻松生成访问令牌

  4. It’s highly flexible as users can access the Kubernetes cluster on different computers, just by generating new tokens

    由于用户可以通过生成新令牌访问不同计算机上的Kubernetes集群,因此具有很高的灵活性
  5. Access can always be revoked by removing the access token on github.com (in case the github token is leaked)

    始终可以通过删除github.com上的访问令牌来撤消访问(以防github令牌泄漏)

实施GitHub身份验证 (Implementing GitHub authentication)

We authenticate our team members using GitHub token. Kubernetes supports a webhook token authenticator plugin to allow a remote service to authenticate. So all we have to do is implement a webhook that verifies the token. When a user tries to authenticate to the Kubernetes API, the Kubernetes API server calls this authenticator to verify the bearer token. This authenticator checks if the access token is valid using GitHub API and returns the GitHub username to the API server by checking whether the requested user has access to the resource. It uses Role-Based Access Control (RBAC) rules. Note that we have to run the webhook on Kubernetes master, in order for the API server to access it. This is how we actually implement the WebHook:

我们使用GitHub令牌对团队成员进行身份验证。 Kubernetes支持Webhook 令牌身份验证器插件,以允许远程服务进行身份验证。 因此,我们要做的就是实现一个Webhook来验证令牌。 当用户尝试通过Kubernetes API进行身份验证时,Kubernetes API服务器将调用此身份验证器以验证承载令牌。 该验证器使用GitHub API检查访问令牌是否有效,并通过检查请求的用户是否有权访问资源来将GitHub用户名返回给API服务器。 它使用基于角色的访问控制(RBAC)规则。 请注意,我们必须在Kubernetes主服务器上运行webhook,以便API服务器访问它。 这就是我们实际实现WebHook的方式 :

We used RBAC because it offers the highest flexibility without making config changes on the API server. Besides RBAC, Kubernetes has various authorization strategies. For now, GitHub Authentication doesn’t entirely remove admin responsibilities. An admin is still needed in certain scenarios:

我们之所以使用RBAC,是因为它提供了最高的灵活性,而无需在API服务器上进行配置更改。 除了RBAC,Kubernetes还具有多种授权策略。 目前,GitHub身份验证尚未完全删除管理员职责。 在某些情况下,仍然需要管理员:

  1. If a user wants their own personal namespace, the admin still needs to create the namespace and set RBAC rules for this user

    如果用户需要自己的个人名称空间,则管理员仍需要创建该名称空间并为此用户设置RBAC规则
  2. If there is a new project, the admin still needs to create the namespace and set RBAC rules for this project

    如果有一个新项目,管理员仍然需要创建名称空间并为此项目设置RBAC规则

When setting up the project, the admin can designate a team lead to control RBAC rules for the participating team members and control who has access to the project namespace.

设置项目时,管理员可以指定团队负责人,为参与团队的成员控制RBAC规则,并控制有权访问项目名称空间的人。

现在Oursky团队成员可以使用GitHub访问集群 (Now Oursky team members can access the cluster with GitHub)

Whenever our teammates need a new deployment for their project (even for personal ones), they could just obtain a token from GitHub. We hope this encourages our team to build something interesting without worrying about stable deployment. You are welcome to take a look at the exact implementation in this github repository. You can also feel free to implement this solution in your own cluster.

每当我们的队友需要为他们的项目进行新的部署时(甚至是个人的),他们都可以从GitHub获得令牌。 我们希望这会鼓励我们的团队构建一些有趣的东西而不必担心稳定的部署。 欢迎您查看此github存储库中的确切实现。 您也可以在自己的集群中随意实施此解决方案。

Building an app? I’m currently working on an open source backend at Oursky that will make your job easier.

建立应用程式? 我目前正在Oursky上从事开源后端的工作 ,这将使您的工作更轻松。

翻译自: https://www.freecodecamp.org/news/how-i-built-a-kubernetes-cluster-so-my-coworkers-could-deploy-apps-faster-ad5567bf6fa8/

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

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

相关文章

使用uWSGI部署django项目

先说说什么是uWSGI吧,他是实现了WSGI协议、uwsgi、http等协议的一个web服务器,那什么是WSGI呢? WSGI是一种Web服务器网关接口。它是一个Web服务器(如nginx)与应用服务器(如uWSGI服务器)通信的一…

8 包含min函数的栈

0 引言 题目:定义栈的数据结构,请在该类型中实现一个能够得到栈的最小元素的min函数。在该栈中,调用min、push及pop的时间复杂度都是O(1). 1 抽象问题具体化 2 具体问题抽象分析 需要解决的两个主要问题如下。 &#x…

《Adobe Illustrator大师班:经典作品与完美技巧赏析》—Svetlana Makarova

本节书摘来自异步社区《Adobe Illustrator大师班:经典作品与完美技巧赏析》一书中的Svetlana Makarova,作者【英】Sharon Milne,更多章节内容可以访问云栖社区“异步社区”公众号查看。 Svetlana MakarovaAdobe Illustrator大师班:经典作品与…

navicat无法连接远程mysql数据库_navicat无法远程连接mysql的解决方法

近日在Ubuntu上安装了一个 MySQL 5.0,因为使用 phpMyAdmin 还必须安装 PHP,所以打算直接使用远程管理工具Navicat for MySQL 来连接。在 Ubuntu 中通过 mysql 命令行创建好一个数据表并分配了权限:代码如下:GRANT ALL ON testdb.* TO usera I…

有关软件测试的证书,软件测试证书有用吗

要想知道证书有什么用,我们就要详细了解软件评测师考试,以及拿到证书的价值。那么下面和小编来看看这篇软件测试证书有用吗,一定会有收获。一、证书考试软件评测师考试是全国计算机技术与软件技术资格考试的一个中级考试。考试不规定学历和资…

计算机科学导论第五版_五月份将开始提供438项免费在线编程和计算机科学课程

计算机科学导论第五版Five years ago, universities like MIT and Stanford first opened up free online courses to the public. Today, more than 700 schools around the world have created thousands of free online courses.五年前,麻省理工学院和斯坦福大学…

python D29 socketserver以及FTB

一、socketserver 基于tcp协议下的socket只能和一个客户端通信,如果用socketserver可以实现和多个客户端通信。 他是在socket的基础上进行封装,也就是说底层还是调用的socket,在py2.7里面叫做SocketServer也就是大写了两个S,在py3…

计算机节电模式不能打开,电脑进入节电模式打不开怎么办

大家好,我是时间财富网智能客服时间君,上述问题将由我为大家进行解答。电脑进入节电模式打不开的原因及解决方法如下:1、显示器和显卡接触不良解决办法:检查显示器和显卡的连接是否正确,接触是否良好;2、显…

sphinx mysql存储引擎_基于Sphinx+MySQL的千万级数据全文检索(搜索引擎)架构设计...

Sphinx,单一索引最大可包含1亿条记录,在1千万条记录情况下的查询速度为0.x秒(毫秒级)。Sphinx创建索引的速度为:创建100万条记录的索引只需3~4分钟,创建1000万条记录的索引可以在50分钟内完成,而只包含最新…

《第一桶金怎么赚——淘宝开店创业致富一册通》一一1.1 创业者需具备的素质...

本节书摘来自异步社区出版社《第一桶金怎么赚——淘宝开店创业致富一册通》一书中的第1章,第1.1节,作者:葛存山,更多章节内容可以访问云栖社区“异步社区”公众号查看。 1.1 创业者需具备的素质 第一桶金怎么赚——淘宝开店创业致…

4-1 线程安全性-原子性-atomic-1

转载于:https://www.cnblogs.com/ZHONGZHENHUA/p/10026627.html

构建了我的第一个React Native应用程序之后,我现在确信这是未来。

by Taylor Milliman泰勒米利曼(Taylor Milliman) 构建了我的第一个React Native应用程序之后,我现在确信这是未来。 (After building my first React Native app, I’m now convinced it’s the future.) After a few weeks of playing around with React Native, …

delphi7 提示注册过期问题

很同情你得经过~ 因为我以前也是经常遇见这个问题~就和你说得一样~ 后来~ 我发现 下载使用的Delphi 7只能使用一个注册码,那就是:6AMD-PKG68E-DB8PP7-9SFE 3QH-9QW所以,你先把C:\Documents and Settings\Administrator\.borland文件夹下的两个文件删除然后用 Progra…

计算机开机引导的结果是,电脑开机显示引导媒体是怎么回事

电脑开机显示引导媒体是怎么回事分类:数据恢复常见问题|最后更新:2020年4月9日开机显示重新启动并选择适当的引导设备或插入1.如果主机上接有可移动存储介质(如光盘、移动硬盘、U盘等),将其拔掉,然后重启。2.如果仍然这样,进入主板设置中,依次检测以下几…

《操作系统真象还原》——0.23 操作系统是如何识别文件系统的

本节书摘来自异步社区《操作系统真象还原》一书中的第0章,第0.23节,作者:郑钢著,更多章节内容可以访问云栖社区“异步社区”公众号查看 0.23 操作系统是如何识别文件系统的 我们知道,一个硬盘上可以有很多分区&#xf…

mysql怎样修改my ini_mysql修改my.ini报错怎么办

mysql修改my.ini报错的解决办法:首先将mysql默认编码改成utf8mb4,并修改【my.ini】配置;然后修改变量,并检查是否设置成功即可。更多相关免费学习推荐:mysql教程(视频)mysql修改my.ini报错的解决办法:将mys…

golang---map类型

map 类似其它语言中的哈希表或字典,以key-value形式存储数据key必须是支持或!比较运算的类型,不可以是函数、map或sliceMap查找比线性搜索快很多,但比使用索引访问数据的类型慢100倍 Map使用make()创建,支持:这种简写方式 make([k…

易语言程序应用程序错误退出_为什么我退出Google并构建了一个向孩子们教授个人理财的应用程序

易语言程序应用程序错误退出Many of my friends thought I was crazy to leave a great position at Google to help parents and kids learn about money. Maybe they’re right.我的许多朋友都认为我为在谷歌上任职以帮助父母和孩子了解金钱而感到疯狂。 也许他们是对的。 B…

蓝叠 正在检查服务器最新,Windows update一直停留在正在检查更新

Windows update一直停留在正在检查更新,为什么啊?一、查看相关服务是否开始:请您根据以下步骤,确认windows update & BITS服务设置1. 按下WinR键输入“services.msc”(输入时不要打引号),并按下回车。如果此时弹出…

spring-DataSource

spring支持的dataSource有好多, 如:自带的org.springframework.jdbc.datasource.DriverManagerDataSource ibatis、c3p0、JDBC、hibernate等等; 首先看第一种,使用自带的datasource: 1、项目结构 提示:spri…