Merge pull request #6003 from haoqixu/master

Translated by @haoqixu
This commit is contained in:
VicYu 2017-08-29 10:14:54 +08:00 committed by GitHub
commit 3628e3f4c9
3 changed files with 143 additions and 142 deletions

View File

@ -1,141 +0,0 @@
### 【翻译中@haoqixu】What is Kubernetes?
Kubernetes, or k8s ( _k, 8 characters, s...get it?_ ), or “kube” if youre into brevity, is an open source platform that automates [Linux container][3] operations. It eliminates many of the manual processes involved in deploying and scaling containerized applications. In other words, you can cluster together groups of hosts running Linux containers, and Kubernetes helps you easily and efficiently manage those clusters. These clusters can span hosts across [public][4], [private][5], or hybrid clouds.
Kubernetes was originally developed and designed by engineers at Google. Google was one of the [early contributors to Linux container technology][6] and has talked publicly about how [everything at Google runs in containers][7]. (This is the technology behind Googles cloud services.) Google generates more than 2 billion container deployments a week—all powered by an internal platform: [Borg][8]. Borg was the predecessor to Kubernetes and the lessons learned from developing Borg over the years became the primary influence behind much of the Kubernetes technology.
_Fun fact: The seven spokes in the Kubernetes logo refer to the projects original name, “[Project Seven of Nine][1].”_
Red Hat was one of the first companies to work with Google on Kubernetes, even prior to launch, and has become the [2nd leading contributor][9] to Kubernetes upstream project. Google [donated][10] the Kubernetes project to the newly formed [Cloud Native Computing Foundation][11] in 2015.
* * *
### Why do you need Kubernetes?
Real production apps span multiple containers. Those containers must be deployed across multiple server hosts. Kubernetes gives you the orchestration and management capabilities required to deploy containers, at scale, for these workloads. Kubernetes orchestration allows you to build application services that span multiple containers, schedule those containers across a cluster, scale those containers, and manage the health of those containers over time.
Kubernetes also needs to integrate with networking, storage, security, telemetry and other services to provide a comprehensive container infrastructure.
![Kubernetes explained - diagram](https://www.redhat.com/cms/managed-files/styles/max_size/s3/kubernetes-diagram-902x416.png?itok=C_wxL4HV "Kubernetes explained - diagram")
Of course, this depends on how youre using containers in your environment. A rudimentary application of Linux containers treats them as efficient, fast virtual machines. Once you scale this to a production environment and multiple applications, it's clear that you need multiple, colocated containers working together to deliver the individual services. This significantly multiplies the number of containers in your environment and as those containers accumulate, the complexity also grows.
Kubernetes fixes a lot of common problems with container proliferation—sorting containers together into a ”pod.” Pods add a layer of abstraction to grouped containers, which helps you schedule workloads and provide necessary services—like networking and storage—to those containers. Other parts of Kubernetes help you load balance across these pods and ensure you have the right number of containers running to support your workloads.
With the right implementation of Kubernetes—and with the help of other open source projects like [Atomic Registry][12], [Open vSwitch][13], [heapster][14], [OAuth][15], and [SELinux][16]— you can orchestrate all parts of your container infrastructure.
* * *
### What can you do with Kubernetes?
The primary advantage of using Kubernetes in your environment is that it gives you the platform to schedule and run containers on clusters of physical or virtual machines. More broadly, it helps you fully implement and rely on a container-based infrastructure in production environments. And because Kubernetes is all about automation of operational tasks, you can do many of the same things that other application platforms or management systems let you do, but for your containers.
With Kubernetes you can:
* Orchestrate containers across multiple hosts.
* Make better use of hardware to maximize resources needed to run your enterprise apps.
* Control and automate application deployments and updates.
* Mount and add storage to run stateful apps.
* Scale containerized applications and their resources on the fly.
* Declaratively manage services, which guarantees the deployed applications are always running how you deployed them.
* Health-check and self-heal your apps with autoplacement, autorestart, autoreplication, and autoscaling.
Kubernetes, however, relies on other projects to fully provide these orchestrated services. With the addition of other open source projects, you can fully realize the power of Kubernetes. These necessary pieces include (among others):
* Registry, through projects like Atomic Registry or Docker Registry.
* Networking, through projects like OpenvSwitch and intelligent edge routing.
* Telemetry, through projects such as heapster, kibana, hawkular, and elastic.
* Security, through projects like LDAP, SELinux, RBAC, and OAUTH with multi-tenancy layers.
* Automation, with the addition of Ansible playbooks for installation and cluster life-cycle management.
* Services, through a rich catalog of precreated content of popular app patterns.
[Get all of this, prebuilt and ready to deploy, with Red Hat OpenShift][17]
* * *
### Learn to speak Kubernetes
Like any technology, there are a lot of words specific to the technology that can be a barrier to entry. Let's break down some of the more common terms to help you understand Kubernetes.
**Master:** The machine that controls Kubernetes nodes. This is where all task assignments originate.
**Node:** These machines perform the requested, assigned tasks. The Kubernetes master controls them.
**Pod:** A group of one or more containers deployed to a single node. All containers in a pod share an IP address, IPC, hostname, and other resources. Pods abstract network and storage away from the underlying container. This lets you move containers around the cluster more easily.
**Replication controller: ** This controls how many identical copies of a pod should be running somewhere on the cluster.
**Service:** This decouples work definitions from the pods. Kubernetes service proxies automatically get service requests to the right pod—no matter where it moves to in the cluster or even if its been replaced.
**Kubelet:** This service runs on nodes and reads the container manifests and ensures the defined containers are started and running.
**kubectl:** This is the command line configuration tool for Kubernetes.
[Had enough? No? Check out the Kubernetes glossary.][18]
* * *
### Using Kubernetes in production
Kubernetes is open source. And, as such, theres not a formalized support structure around that technology—at least not one youd trust your business on. If you had an issue with your implementation of Kubernetes, while running in production, youre not going to be very happy. And your customers probably wont, either.
Thats where [Red Hat OpenShift][2] comes in. OpenShift is Kubernetes for the enterprise—and a lot more. OpenShift includes all of the extra pieces of technology that makes Kubernetes powerful and viable for the enterprise, including: registry, networking, telemetry, security, automation, and services. With OpenShift, your developers can make new containerized apps, host them, and deploy them in the cloud with the scalability, control, and orchestration that can turn a good idea into new business quickly and easily.
Best of all, OpenShift is supported and developed by the #1 leader in open source, Red Hat.
* * *
### A look at how Kubernetes fits into your infrastructure
![Kubernetes diagram](https://www.redhat.com/cms/managed-files/styles/max_size/s3/kubernetes-diagram-2-824x437.png?itok=KmhLmkgi "Kubernetes diagram")
Kubernetes runs on top of an operating system ([Red Hat Enterprise Linux Atomic Host][19], for example) and interacts with pods of containers running on the nodes. The Kubernetes master takes the commands from an administrator (or DevOps team) and relays those instructions to the subservient nodes. This handoff works with a multitude of services to automatically decide which node is best suited for the task. It then allocates resources and assigns the pods in that node to fulfill the requested work.
So, from an infrastructure point of view, there is little change to how youve been managing containers. Your control over those containers happens at a higher level, giving you better control without the need to micromanage each separate container or node. Some work is necessary, but its mostly a question of assigning a Kubernetes master, defining nodes, and defining pods.
### What about docker?
The [docker][20] technology still does what it's meant to do. When kubernetes schedules a pod to a node, the kubelet on that node will instruct docker to launch the specified containers. The kubelet then continuously collects the status of those containers from docker and aggregates that information in the master. Docker pulls containers onto that node and starts and stops those containers as normal. The difference is that an automated system asks docker to do those things instead of the admin doing so by hand on all nodes for all containers.
--------------------------------------------------------------------------------
via: https://www.redhat.com/en/containers/what-is-kubernetes
作者:[www.redhat.com ][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.redhat.com/
[1]:https://cloudplatform.googleblog.com/2016/07/from-Google-to-the-world-the-Kubernetes-origin-story.html
[2]:https://www.redhat.com/en/technologies/cloud-computing/openshift
[3]:https://www.redhat.com/en/containers/whats-a-linux-container
[4]:https://www.redhat.com/en/topics/cloud-computing/what-is-public-cloud
[5]:https://www.redhat.com/en/topics/cloud-computing/what-is-private-cloud
[6]:https://en.wikipedia.org/wiki/Cgroups
[7]:https://speakerdeck.com/jbeda/containers-at-scale
[8]:http://blog.kubernetes.io/2015/04/borg-predecessor-to-kubernetes.html
[9]:http://stackalytics.com/?project_type=kubernetes-group&metric=commits
[10]:https://techcrunch.com/2015/07/21/as-kubernetes-hits-1-0-google-donates-technology-to-newly-formed-cloud-native-computing-foundation-with-ibm-intel-twitter-and-others/
[11]:https://www.cncf.io/
[12]:http://www.projectatomic.io/registry/
[13]:http://openvswitch.org/
[14]:https://github.com/kubernetes/heapster
[15]:https://oauth.net/
[16]:https://selinuxproject.org/page/Main_Page
[17]:https://www.redhat.com/en/technologies/cloud-computing/openshift
[18]:https://kubernetes.io/docs/reference/
[19]:https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux/options
[20]:https://www.redhat.com/en/containers/what-is-docker

View File

@ -1,4 +1,4 @@
[Kubernetes at GitHub][10]
【翻译中 @haoqixu[Kubernetes at GitHub][10]
============================================================
Over the last year, GitHub has gradually evolved the infrastructure that runs the Ruby on Rails application responsible for `github.com` and `api.github.com`. We reached a big milestone recently: all web and API requests are served by containers running in [Kubernetes][13] clusters deployed on our [metal cloud][14]. Moving a critical application to Kubernetes was a fun challenge, and were excited to share some of what weve learned with you today.

View File

@ -0,0 +1,142 @@
### Kubernetes 是什么?
Kubernetes简称 k8sk8个字符s或者 “kube”是一个开源的 [Linux 容器][3]自动化平台,消除了容器化应用程序在部署、伸缩时涉及到的许多手动操作。换句话说,你可以将多台主机组合成集群来运行 Linux 容器Kubernetes 能帮助你简单高效地管理集群。而且构成这些集群的主机还可以跨越[公有云][4]、[私有云][5]以及混合云。
Kubernetes 最开始是由 Google 的工程师设计开发的。Google 作为 [Linux 容器技术的早期贡献者][6]之一,曾公开演讲介绍 [Google 如何将一切都运行于容器之中][7](这是 Google 云服务背后的技术。Google 一周的容器部署超过 20 亿次,全部的工作都由内部平台 [Borg][8] 支撑。Borg 是 Kubernetes 的前身,几年来开发 Borg 的经验教训也成了影响 Kubernetes 中许多技术的主要因素。
_趣闻: Kubernetes logo 中的七个辐条来源于项目原先的名称, “[Seven of Nine 项目][1]”译者Borg 是「星际迷航」中的一个宇宙种族Seven of Nine 是该种族的一名女性角色。_
红帽作为最早与 Google 合作开发 Kubernetes 的公司之一(甚至早于 Kubernetes 的发行),已经是 Kubernetes 上游项目的第二大贡献者。Google 在 2015 年把 Kubernetes 项目捐献给了新成立的 [CNCFCloud Native Computing Foundation基金会][11]。
* * *
### 为什么你需要 Kubernetes
真实的生产环境应用会包含多个容器而这些容器还很可能会跨越服务器主机。Kubernetes 提供了为工作负载大规模部署容器的编排与管理能力。Kubernetes 的编排器让你能够构建多容器的应用服务,在集群上调度或伸缩这些容器,以及管理它们随时间变化的健康状态。
Kubernetes also needs to integrate with networking, storage, security, telemetry and other services to provide a comprehensive container infrastructure.
Kubernetes 需要与网络、存储、安全、监控等其它服务集成才能提供综合性的容器基础设施。
![Kubernetes 解释-图表](https://www.redhat.com/cms/managed-files/styles/max_size/s3/kubernetes-diagram-902x416.png?itok=C_wxL4HV "Kubernetes 解释-图表")
当然,这取决于你如何在你的环境中使用容器。一个初步的 Linux 容器应用程序把容器作为高效快速的虚拟机。一旦把它部署到生产环境或者扩展为多个应用,你需要许多组托管在相同位置的容器合作提供某个单一的服务。随着这些容器的累积,你的运行环境中容器的数量会急剧增加,复杂度也随之增长。
Kubernetes 通过将容器分类组成 “pod” 来解决容器增殖带来的问题。Pod 为容器分组提供了一层抽象以此协助你调度工作负载以及为这些容器提供类似网络与存储这类必要的服务。Kubernetes 的其它组件帮助你对 pod 进行负载均衡,以保证有合适数量的容器支撑你的工作负载。
正确执行的 Kubernetes结合类似 [Atomic Registry][12]、[Open vSwitch][13]、[heapster][14]、[OAuth][15] 和 [SELinux][16] 的开源项目,让你可以管理你自己的整个容器基础设施。
* * *
### Kubernetes 能做些什么?
在生产环境中使用 Kubernetes 的主要优势在于它提供了在物理机或虚拟机集群上调度和运行容器的平台。更宽泛地说,它能帮你在生产环境中实现可以依赖的基于容器的基础设施。而且,由于 Kubernetes 本质上就是作业任务的自动化平台,你可以执行一些其它应用程序平台或管理系统支持的操作,只不过操作对象变成了容器。
有了 Kubernetes你可以
* 跨主机编排容器。
* 更充分地利用硬件资源来最大化地满足企业应用的需求。
* 控制与自动化应用的部署与升级。
* 为有状态的应用程序挂载和添加存储器。
* 线上扩展或裁剪容器化应用程序与它们的资源。
* 声明式的容器管理,保证应用按照我们部署的方式运作。
* 通过自动布局、自动重启、自动复制、自动伸缩实现应用的状态检查与自我修复。
然而 Kubernetes 依赖其它项目来提供完整的编排服务。结合其它开源项目作为其组件,你才能充分感受到 Kubernetes 的能力。这些必要组件包括:
* 仓库Atomic Registry、Docker Registry 等。
* 网络OpenvSwitch 和 智能边缘路由等。
* 监控heapster、kibana、hawkular 和 elastic。
* 安全LDAP、SELinux、 RBAC 与 支持多租户的 OAUTH。
* 自动化:通过 Ansible 的 playbook 进行集群的安装和生命周期管理。
* 服务:大量事先创建好的常用应用模板。
[红帽 OpenShift 为容器部署预先集成了上面这些组件。][17]
* * *
### Kubernetes 入门
和其它技术一样,大量的专有名词有可能成为入门的障碍。下面解释一些通用的术语,希望帮助你理解 Kubernetes。
**Master主节点** 控制 Kubernetes 节点的机器,也是创建作业任务的地方。
**Node节点** 这些机器在 Kubernetes 主节点的控制下执行被分配的任务。
**Pod** 由一个或多个容器构成的集合,作为一个整体被部署一个单一节点。同一个 pod 中的容器共享 IP 地址、进程间通讯IPC、主机名以及其它资源。Pod 将底层网络和存储抽象出来,使得集群内的容器迁移更为便捷。
**Replication controller复制控制器** 控制一个 pod 在集群上运行的实例数量。
**Service服务** 将服务内容与具体的 pod 分离。Kubernetes 服务代理负责自动将服务请求分发到正确的 pod 处,用户无需考虑 pod 部署的位置甚至可以把它替换掉。
**Kubelet** 这个守护进程运行在各个工作节点上,负责获取容器列表,保证被声明的容器已经启动并且正常运行。
**kubectl** 这是 Kubernetes 的命令行配置工具。
[上面这些知识就足够了吗?不,这仅仅是一小部分,更多内容请查看 Kubernetes 术语表。][18]
* * *
### 生产环境中使用 Kubernetes
Kubernetes 是开源的,所以没有正式的技术支持组织为你的商业业务提供支持。如果在生存环境使用 Kubernetes 时遇到问题,你恐怕不会太愉快,当然你的客户也不会太高兴。
这就是[红帽 OpenShift][2] 要解决的问题。OpenShift 是为企业提供的 Kubernetes ——并且集成了更多的组件。OpenShift 包含了强化 Kubernetes 功能使其更适用于企业场景的额外部件包括仓库、网络、监控、安全、自动化和服务在内。OpenShift 使得开发者能够在具有伸缩性、控制和编排能力的云端开发、托管和部署容器化的应用,快速便捷地把想法转变为业务。
而且OpenShift 还是由头号开源领导公司红帽支持和开发的。
* * *
### Kubernetes 如何适配你的基础设施
![Kubernetes 图表](https://www.redhat.com/cms/managed-files/styles/max_size/s3/kubernetes-diagram-2-824x437.png?itok=KmhLmkgi "Kubernetes 图表")
Kubernetes 运行在操作系统(例如 [Red Hat Enterprise Linux Atomic Host][19]之上操作着节点上运行的容器。Kubernetes 主节点master从管理员或者 DevOps 团队)处接受命令,再把指令转交给附属的节点。转交工作由 service 自动决定接受任务的节点,然后在该节点上分配资源并指派 pod 来完成任务请求。
所以从基础设施的角度,管理容器的方式发生了一点小小的变化。对容器的控制在更高的层次进行,这不再需要用户管理每个单独的容器或者节点,提供了更佳的控制方式。必要的工作则主要集中在如何指派 Kubernetes 主节点,定义节点和 pod 等问题上。
### docker 在 Kubernetes 中的角色
[Docker][20] 依然执行它原本的任务。当 Kubernetes 把 pod 调度到节点上,节点上的 kubelet 会指示 docker 启动特定的容器。接着kubelet 会通过 docker 持续地收集容器的信息然后提交到主节点上。Docker 如往常一样拉取容器镜像、启动或停止容器。不同点仅仅在于这是由自动化系统控制而非管理员在每个节点上手动操作的。
--------------------------------------------------------------------------------
via: https://www.redhat.com/en/containers/what-is-kubernetes
作者:[www.redhat.com ][a]
译者:[haoqixu](https://github.com/haoqixu)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.redhat.com/
[1]:https://cloudplatform.googleblog.com/2016/07/from-Google-to-the-world-the-Kubernetes-origin-story.html
[2]:https://www.redhat.com/en/technologies/cloud-computing/openshift
[3]:https://www.redhat.com/en/containers/whats-a-linux-container
[4]:https://www.redhat.com/en/topics/cloud-computing/what-is-public-cloud
[5]:https://www.redhat.com/en/topics/cloud-computing/what-is-private-cloud
[6]:https://en.wikipedia.org/wiki/Cgroups
[7]:https://speakerdeck.com/jbeda/containers-at-scale
[8]:http://blog.kubernetes.io/2015/04/borg-predecessor-to-kubernetes.html
[9]:http://stackalytics.com/?project_type=kubernetes-group&metric=commits
[10]:https://techcrunch.com/2015/07/21/as-kubernetes-hits-1-0-google-donates-technology-to-newly-formed-cloud-native-computing-foundation-with-ibm-intel-twitter-and-others/
[11]:https://www.cncf.io/
[12]:http://www.projectatomic.io/registry/
[13]:http://openvswitch.org/
[14]:https://github.com/kubernetes/heapster
[15]:https://oauth.net/
[16]:https://selinuxproject.org/page/Main_Page
[17]:https://www.redhat.com/en/technologies/cloud-computing/openshift
[18]:https://kubernetes.io/docs/reference/
[19]:https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux/options
[20]:https://www.redhat.com/en/containers/what-is-docker