Skip to Content
Kafka Connect
book

Kafka Connect

by Mickael Maison, Kate Stanley
May 2025
Intermediate to advanced
402 pages
5h 9m
Chinese
O'Reilly Media, Inc.
Content preview from Kafka Connect

第 10 章 在 Kubernetes 上管理 Kafka Connect 在 Kubernetes 上管理 Kafka Connect

本作品已使用人工智能进行翻译。欢迎您提供反馈和意见:translation-feedback@oreilly.com

Kubernetes 已成为许多工作负载的流行部署环境。根据Cloud Native Computing Foundation(CNCF)的数据,目前使用 Kubernetes 和容器作为部署工作负载基础的公司数量创下了历史新高。2021 年,他们发现96%的企业正在评估或使用这些技术。

在本章中,我们将了解 Kubernetes 为何如此受欢迎,并回顾在 Kubernetes 上运行 Kafka Connect 所需的注意事项。我们还讨论了 Kubernetes 操作员提供的一些好处,例如自动部署资源,让你声明式地管理你的工作负载。最后,我们以支持 Kafka Connect 的 Strimzi 操作员为例进行介绍。

Kubernetes 简介

要了解为什么您可能会对将 Kafka Connect 部署到 Kubernetes 感兴趣,重要的是您了解容器和 Kubernetes 带来的好处,以及这些技术如何工作的一些基本原理。如果您已经熟悉 Kubernetes,那么可以跳过本节。

虚拟化技术

在深入了解Kubernetes 之前,我们先来看看容器。容器是用于运行应用程序的独立虚拟环境。它们允许你以隔离的方式在相同的底层基础架构上运行多个不同的工作负载。单个容器可以预留 CPU 和内存,这意味着其中运行的应用程序不会干扰其他容器中运行的其他应用程序。它们还拥有自己的内部本地网络,提供进一步的隔离。

容器并不是第一个提供这种隔离功能的技术。虚拟机(VM)也提供类似的功能。容器与虚拟机的主要区别在于,容器不包含操作系统(OS),而是依赖于主机系统的操作系统。这意味着容器比虚拟机更小,在资源使用方面也更轻便。由于不需要启动或停止操作系统,它们的启动和关闭速度也更快。容器包含运行应用程序所需的所有库和依赖项,因此可以重复部署。这意味着,如果你有多个环境,就不必在每个环境中安装正确的依赖项。它消除了 "在我的机器上运行 "的问题,相反,你只需运行你选择的容器平台即可。

容器与云计算、持续集成和部署(CI/CD)等其他实践一起使用,非常受欢迎。许多行业的公司都采用了容器,并将其用于生产中的应用程序。公司通常有成百上千个容器在运行其工作负载,因此需要能够轻松部署、管理和监控它们的工具。这就是 Kubernetes 的用武之地。

Kubernetes(又称 K8s)是 CNCF 项目,提供了一个开源容器编排平台。其功能包括

自我修复
重启失败的容器
滚动和回滚
管理容器更新,同时保持容器健康。
水平缩放
增加或减少容器实例的数量。
自动包装桶
计算集装箱的最佳摆放位置,优化资源利用。
应用程序配置
支持应用配置的机制,无需重新启动运行这些应用的容器。
批量执行
运行批处理进程。
存储协调
对底层存储的抽象。
Network+
底层网络的抽象和机制,以促进发现和应用程序的负载平衡。

除了这些功能外,Kubernetes 在的设计上还具有可扩展性。因此,正如我们稍后看到的,你可以进一步定制它,以适应你的工作负载。你可以在自己的基础设施上运行 Kubernetes,也可以使用技术供应商提供的各种 Kubernetes 发行版。这些供应商通常会添加额外的功能,并提供商业支持。

备注

Cloud Native Computing ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Kafka Connect

Kafka Connect

Mickael Maison, Kate Stanley

Publisher Resources

ISBN: 9798341658189