Skip to Content
在 Kubernetes 上管理云原生数据
book

在 Kubernetes 上管理云原生数据

by Jeff Carpenter, Patrick McFadin
May 2025
Beginner to intermediate
332 pages
4h 22m
Chinese
O'Reilly Media, Inc.
Content preview from 在 Kubernetes 上管理云原生数据

第 5 章 使用操作员在 Kubernetes 上自动管理数据库 使用操作器在 Kubernetes 上自动管理数据库

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

在本章中,我们将继续探讨在 Kubernetes 上运行数据库的问题,但将重点从安装转移到操作上。仅仅知道数据库应用程序的元素如何映射到 Kubernetes 为初始部署提供的基元上是不够的。您还需要知道如何长期维护该基础架构,以支持您的关键业务应用。在本章中,我们将介绍 Kubernetes 的操作方法,以便您能够保持数据库的有效运行。

数据库和其他数据基础设施的运行由 "第二天 "任务的共同清单组成,包括以下内容:

  • 向上和向下扩展容量,包括在调整后的集群中重新分配工作负载

  • 监控数据库健康状况并替换故障(或失效)实例

  • 执行日常维护任务,如 Apache Cassandra 中的修复操作

  • 更新和修补软件

  • 维护可能会过期的安全访问密钥和其他凭证

  • 执行备份,并在灾难恢复中使用备份恢复数据

虽然不同技术执行这些任务的细节可能各不相同,但我们共同关心的是如何利用自动化来减少人类操作员的工作量,并使我们能够以越来越大的规模运行基础设施。我们如何才能将人类操作员围绕这些任务所积累的知识融入其中?传统的云操作使用的是在云基础设施外部运行的脚本工具,而一种更加云原生的方法是让这种数据库控制逻辑直接在 Kubernetes 集群内运行。本章我们要探讨的问题是:什么是 Kubernetes 友好的方式来表示这种控制逻辑?

扩展 Kubernetes 控制平面

好消息是,Kubernetes 的设计者对这个问题一点也不感到惊讶。事实上,Kubernetes 的控制平面和应用程序接口就是为了可扩展而设计的。Kelsey Hightower 等人将 Kubernetes 称作"构建平台的平台"。

Kubernetes 提供多个扩展点,主要与其控制平面有关。图 5-1包括Kubernetes 的核心组件,如 API 服务器、调度器、Kubelet 和kubectl ,以及它们支持的扩展点的指示。

Kubernetes control plane and extension points
图 5-1. Kubernetes 控制平面和扩展点

现在,让我们从本地客户端上的组件和 Kubernetes 集群内的组件开始,研究扩展 Kubernetes 控制平面的细节。其中许多扩展点都与数据库和数据基础设施相关。

扩展 Kubernetes 客户端

kubectl 命令行工具是许多用户与 Kubernetes 交互的主要界面。您可以使用插件扩展 ,这些kubectl 插件由您下载并在系统的 上提供,或者使用PATHKrew(一个维护 kubectl 插件列表的软件包管理器)。插件可执行的任务包括在多个资源甚至多个集群中执行批量操作,或评估集群状态并提出安全成本建议。本章重点讨论的几个插件可用于管理操作员和自定义资源。

扩展 Kubernetes 控制平面组件

Kubernetes 控制平面的核心由多个控制平面组件组成,包括 API 服务器、调度器、控制器管理器、云控制器管理器和 etcd。虽然这些组件可以在 Kubernetes 集群内的任何节点上运行,但它们通常被分配到一个不运行任何用户应用 Pod 的专用节点上。这些组件如下: ...

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

《使用 Kubernetes 实现云原生 DevOps(第二版)》

《使用 Kubernetes 实现云原生 DevOps(第二版)》

Justin Domingus, John Arundel
生产 Kubernetes

生产 Kubernetes

Josh Rosso, Rich Lander, Alex Brand, John Harris

Publisher Resources

ISBN: 9798341659667