[zh] sync 2023-03-01-introducing-kwok/ (#39739)

pull/39750/head
Michael 2023-03-01 22:14:24 +08:00 committed by GitHub
parent 74d09c9068
commit 74746dd13f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 170 additions and 0 deletions

View File

@ -0,0 +1,168 @@
---
layout: blog
title: "介绍 KWOKKubernetes WithOut Kubelet没有 Kubelet 的 Kubernetes"
date: 2023-03-01
slug: introducing-kwok
---
<!--
layout: blog
title: "Introducing KWOK: Kubernetes WithOut Kubelet"
date: 2023-03-01
slug: introducing-kwok
canonicalUrl: https://kubernetes.dev/blog/2023/03/01/introducing-kwok/
-->
<!--
**Author:** Shiming Zhang (DaoCloud), Wei Huang (Apple), Yibo Zhuang (Apple)
-->
**作者:** Shiming Zhang (DaoCloud), Wei Huang (Apple), Yibo Zhuang (Apple)
**译者:** Michael Yao (DaoCloud)
<img style="float: right; display: inline-block; margin-left: 2em; max-width: 15em;" src="/blog/2023/03/01/introducing-kwok/kwok.svg" alt="KWOK logo" />
<!--
Have you ever wondered how to set up a cluster of thousands of nodes just in seconds, how to simulate real nodes with a low resource footprint, and how to test your Kubernetes controller at scale without spending much on infrastructure?
If you answered "yes" to any of these questions, then you might be interested in KWOK, a toolkit that enables you to create a cluster of thousands of nodes in seconds.
-->
你是否曾想过在几秒钟内搭建一个由数千个节点构成的集群,如何用少量资源模拟真实的节点,
如何不耗费太多基础设施就能大规模地测试你的 Kubernetes 控制器?
如果你曾有过这些想法,那你可能会对 KWOK 有兴趣。
KWOK 是一个工具包,能让你在几秒钟内创建数千个节点构成的集群。
<!--
## What is KWOK?
KWOK stands for Kubernetes WithOut Kubelet. So far, it provides two tools:
-->
## 什么是 KWOK {#what-is-kwok}
KWOK 是 Kubernetes WithOut Kubelet 的缩写,即没有 Kubelet 的 Kubernetes。
到目前为止KWOK 提供了两个工具:
<!--
`kwok`
: `kwok` is the cornerstone of this project, responsible for simulating the lifecycle of fake nodes, pods, and other Kubernetes API resources.
`kwokctl`
: `kwokctl` is a CLI tool designed to streamline the creation and management of clusters, with nodes simulated by `kwok`.
-->
`kwok`
: `kwok` 是这个项目的基石负责模拟伪节点、Pod 和其他 Kubernetes API 资源的生命周期。
`kwokctl`
: `kwokctl` 是一个 CLI 工具,设计用于简化创建和管理由 `kwok` 模拟节点组成的集群。
<!--
## Why use KWOK?
KWOK has several advantages:
-->
## 为什么使用 KWOK {#why-use-kwok}
KWOK 具有下面几点优势:
<!--
- **Speed**: You can create and delete clusters and nodes almost instantly, without waiting for boot or provisioning.
- **Compatibility**: KWOK works with any tools or clients that are compliant with Kubernetes APIs, such as kubectl, helm, kui, etc.
- **Portability**: KWOK has no specific hardware or software requirements. You can run it using pre-built images, once Docker or Nerdctl is installed. Alternatively, binaries are also available for all platforms and can be easily installed.
- **Flexibility**: You can configure different node types, labels, taints, capacities, conditions, etc., and you can configure different pod behaviors, status, etc. to test different scenarios and edge cases.
- **Performance**: You can simulate thousands of nodes on your laptop without significant consumption of CPU or memory resources.
-->
- **速度**:你几乎可以实时创建和删除集群及节点,无需等待引导或制备过程。
- **兼容性**KWOK 能够与兼容 Kubernetes API 的所有工具或客户端(例如 kubectl、helm、kui协同作业。
- **可移植性**KWOK 没有特殊的软硬件要求。一旦安装了 Docker 或 Nerdctl你就可以使用预先构建的镜像来运行 KWOK。
另外,二进制文件包适用于所有平台,安装简单。
- **灵活**:你可以配置不同类型的节点、标签、污点、容量、状况等,还可以配置不同的 Pod
行为和状态来测试不同的场景和边缘用例。
- **性能**:你在自己的笔记本电脑上就能模拟数千个节点,无需大量消耗 CPU 或内存资源。
<!--
## What are the use cases?
KWOK can be used for various purposes:
-->
## 使用场景是什么? {#what-are-use-cases}
KWOK 可用于各种用途:
<!--
- **Learning**: You can use KWOK to learn about Kubernetes concepts and features without worrying about resource waste or other consequences.
- **Development**: You can use KWOK to develop new features or tools for Kubernetes without accessing to a real cluster or requiring other components.
- **Testing**:
- You can measure how well your application or controller scales with different numbers of nodes and(or) pods.
- You can generate high loads on your cluster by creating many pods or services with different resource requests or limits.
- You can simulate node failures or network partitions by changing node conditions or randomly deleting nodes.
- You can test how your controller interacts with other components or features of Kubernetes by enabling different feature gates or API versions.
-->
- **学习**:你可以使用 KWOK 学习 Kubernetes 概念和特性,无需顾虑资源浪费或其他后果。
- **开发**:你可以使用 KWOK 为 Kubernetes 开发新特性或新工具,无需接入真实的集群,也不需要其他组件。
- **测试**
- 你可以衡量自己的应用程序或控制器在使用不同数量节点和 Pod 时的扩缩表现如何。
- 你可以用不同的资源请求或限制创建大量 Pod 或服务,在集群上营造高负载的环境。
- 你可以通过更改节点状况或随机删除节点来模拟节点故障或网络分区。
- 你可以通过启用不同的特性门控或 API 版本来测试控制器如何与其他组件交互。
<!--
## What are the limitations?
KWOK is not intended to replace others completely. It has some limitations that you should be aware of:
-->
## 有哪些限制? {#what-are-limiations}
KWOK 并非试图完整替代其他什么。当然也有一些限制需要你多加注意:
<!--
- **Functionality**: KWOK is not a kubelet and may exhibit different behaviors in areas such as pod lifecycle management, volume mounting, and device plugins. Its primary function is to simulate updates of node and pod status.
- **Accuracy**: It's important to note that KWOK doesn't accurately reflect the performance or behavior of real nodes under various workloads or environments. Instead, it approximates some behaviors using simple formulas.
- **Security**: KWOK does not enforce any security policies or mechanisms on simulated nodes. It assumes that all requests from the kube-apiserver are authorized and valid.
-->
- **功能性**KWOK 不是 kubelet。KWOK 在 Pod 生命周期管理、卷挂载和设备插件方面所展现的行为与 kubelet 不同。
KWOK 的主要功能是模拟节点和 Pod 状态的更新。
- **准确性**:需要重点注意 KWOK 还不能确切地反映各种工作负载或环境下真实节点的性能或行为。
KWOK 只能使用一些公式来逼近真实的节点行为。
- **安全性**KWOK 没有对模拟的节点实施任何安全策略或安全机制。
KWOK 假定来自 kube-apiserver 的所有请求都是经过授权且是有效的。
<!--
## Getting started
If you are interested in trying out KWOK, please check its [documents] for more details.
-->
## 入门 {#getting-started}
如果你对试用 KWOK 感兴趣,请查阅 [KWOK 文档](https://kwok.sigs.k8s.io/)了解详情。
<!--
{{< figure src="/blog/2023/03/01/introducing-kwok/manage-clusters.svg" alt="Animation of a terminal showing kwokctl in use" caption="Using kwokctl to manage simulated clusters" >}}
-->
{{< figure src="/blog/2023/03/01/introducing-kwok/manage-clusters.svg" alt="在终端上使用 kwokctl 的动图" caption="使用 kwokctl 管理模拟的集群" >}}
<!--
## Getting Involved
If you're interested in participating in future discussions or development related to KWOK, there are several ways to get involved:
-->
## 欢迎参与 {#getting-involved}
如果你想参与讨论 KWOK 的未来或参与开发,可通过以下几种方式参与进来:
<!--
- Slack: [#kwok] for general usage discussion, [#kwok-dev] for development discussion. (visit [slack.k8s.io] for a workspace invitation)
- Open Issues/PRs/Discussions in [sigs.k8s.io/kwok]
-->
- Slack [#kwok] 讨论一般用法Slack [#kwok-dev] 讨论开发问题(访问 [slack.k8s.io] 获取 KWOK 工作空间的邀请链接)
- 在 [sigs.k8s.io/kwok] 上提出 Issue/PR/Discussion
<!--
We welcome feedback and contributions from anyone who wants to join us in this exciting project.
-->
我们欢迎所有想要加入这个项目的贡献者,欢迎任何形式的反馈和贡献。
[documents]: https://kwok.sigs.k8s.io/
[sigs.k8s.io/kwok]: https://sigs.k8s.io/kwok/
[#kwok]: https://kubernetes.slack.com/messages/kwok/
[#kwok-dev]: https://kubernetes.slack.com/messages/kwok-dev/
[slack.k8s.io]: https://slack.k8s.io/

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 70 70"><path fill="#326CE5" d="m7.907 20.247-.325 1.656-.033.006-1.56 6.763-.415 1.961-.063.086c0 .348-.26 1.093-.324 1.451-.089.508-.223.952-.34 1.465-.223.977-.481 1.984-.67 2.938-.192.968-.517 1.974-.671 2.909-.148.897-.6 2.053-.6 3.01v.03c0 1.74.865 2.698 1.68 3.645.407.474.797.986 1.186 1.478.398.505.811.975 1.2 1.491.76 1.007 1.607 1.973 2.39 2.965.773.978 1.576 2.031 2.384 2.97.41.476.796.983 1.186 1.478.39.494.819.974 1.189 1.474.364.492.802.982 1.188 1.473.36.457.815 1.083 1.201 1.492.408.432.784 1.015 1.184 1.479.42.488.785.997 1.198 1.493.5.6.71.843 1.39 1.274.48.305 1.318.598 2.094.598l24.56.02 1.063-.138c.075-.051.33-.117.455-.167.2-.08.28-.126.452-.198.322-.135.536-.31.797-.505.376-.28.94-.992 1.225-1.378.714-.972 1.595-1.9 2.308-2.87.715-.973 1.597-1.9 2.308-2.87.706-.962 1.55-1.922 2.302-2.874 1.524-1.93 3.09-3.807 4.616-5.739a50.63 50.63 0 0 1 1.151-1.422c.395-.464.752-1.006 1.154-1.45.362-.398.828-.993 1.127-1.447.261-.398.626-1.336.626-1.977v-.71c0-.004-.15-.618-.165-.692-.051-.237-.12-.508-.154-.704-.06-.336-.228-1.127-.332-1.414-.045-.125-.117-.53-.16-.698-.058-.233-.103-.466-.17-.688-.12-.403-.207-.995-.308-1.436-.114-.496-.22-.887-.32-1.397-.05-.263-.122-.4-.166-.691a8.807 8.807 0 0 0-.16-.728c-.13-.469-.639-2.428-.634-2.826l-.042-.09-.373-1.714-.04-.09-.733-3.072c0-.363-.235-.842-.266-1.272-.006-.076-.12-.494-.146-.623-.048-.241-.116-.389-.163-.636-.063-.333-.18-.988-.284-1.255-.11-.28-.196-.925-.3-1.268-.112-.376-.166-.853-.28-1.258-.105-.375-.213-.9-.296-1.272-.242-1.087-.408-1.402-.993-2.143-.49-.621-1.077-.932-1.83-1.277-.156-.072-.346-.176-.519-.25a8.253 8.253 0 0 1-.522-.247c-.312-.195-.732-.322-1.057-.51-.3-.173-.716-.326-1.047-.492a101 101 0 0 0-3.18-1.524 53.67 53.67 0 0 1-2.096-1.01c-.703-.355-1.398-.654-2.1-1.006-.704-.352-1.4-.66-2.101-1.007-.34-.168-.73-.36-1.066-.501-.315-.132-.776-.413-1.069-.5-.19-.056-.799-.385-1.042-.496a30.09 30.09 0 0 1-1.065-.503c-.696-.353-1.412-.66-2.12-1.016-.703-.353-1.395-.653-2.1-1.006-.719-.36-1.368-.7-2.437-.7h-.06c-.958 0-1.415.316-2.082.58a7.04 7.04 0 0 0-.899.432c-.227.142-.668.295-.934.427-1.205.595-2.415 1.134-3.619 1.736-2.398 1.2-4.844 2.27-7.24 3.47-1.207.607-2.41 1.142-3.618 1.737-.606.298-1.202.572-1.811.852-.225.104-.688.369-.898.434-.115.035-.812.368-.923.437-.214.133-.656.318-.901.43-.205.095-.73.384-.898.434-.502.149-1.192.813-1.51 1.182a4.13 4.13 0 0 0-.854 1.839c-.036.224-.471 2.074-.53 2.162z"/><path fill="#cfe3ef" stroke="#355386" d="M7.469 60.078c4.095-8.48 3.708-26.191 7.407-34.164 3.7-7.973 9.248-11.668 19.422-12.64 10.532-.436 18.728 4.667 22.196 13.807s3.326 26.11 6.759 32.462c-3.598-2.245-5.738-4.683-9.648-4.572-3.91.111-5.378 4.094-8.837 4.267-3.46.173-6.42-3.994-10.224-3.819-3.803.175-4.92 3.84-9.266 3.794-4.347-.047-5.702-3.82-9.14-3.693-3.437.127-5.757 1.425-8.669 4.558Z" style="stroke-width:1.00157;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;paint-order:normal"/><ellipse cx="41.148" cy="32.56" fill="#355386" rx="4.3" ry="6.67"/><ellipse cx="24.369" cy="32.56" fill="#355386" rx="4.3" ry="6.67"/><circle cx="41.559" cy="31.23" r="3" fill="#fff"/><circle cx="24.744" cy="31.23" r="3" fill="#fff"/><path d="M34.162 53.377V47.65h1.156v2.543l2.336-2.543h1.555l-2.156 2.23 2.273 3.497H37.83l-1.574-2.688-.938.957v1.73zM40.736 53.377 39.37 47.65h1.184l.863 3.934 1.047-3.934h1.375l1.004 4 .879-4h1.164l-1.39 5.727h-1.227l-1.141-4.282-1.137 4.282zM47.24 50.549q0-.875.262-1.47.195-.437.531-.784.34-.348.742-.516.535-.227 1.235-.227 1.265 0 2.023.786.762.785.762 2.183 0 1.387-.754 2.172-.754.781-2.016.781-1.277 0-2.03-.777-.755-.781-.755-2.148zm1.192-.04q0 .973.449 1.477.449.5 1.14.5.692 0 1.133-.496.446-.5.446-1.496 0-.985-.434-1.469-.43-.484-1.145-.484-.714 0-1.152.492-.437.488-.437 1.476zM53.713 53.377V47.65h1.156v2.543l2.336-2.543h1.555l-2.157 2.23 2.274 3.497H57.38l-1.574-2.688-.938.957v1.73z" style="font-weight:700;font-size:8px;font-family:Sans,Arial;text-anchor:middle;fill:#355386"/></svg>

After

Width:  |  Height:  |  Size: 3.9 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 521 KiB