Skip to Content
Kubernetes编程
book

Kubernetes编程

by Michael Hausenblas, Stefan Schimanski
June 2021
Intermediate to advanced
335 pages
5h 50m
Chinese
China Electric Power Press Ltd.
Content preview from Kubernetes编程
14
1
从软件架构的角度来看,一个控制器通常会使用以下的数据结构(第
3
章中
还会进一步讨论细节):
Informer
Informer
负责观察资源的目标状态,这个过程需要是可伸缩和可持续的。
它们还负责实现重新同步机制(参考“
3.4 Informer
和缓存”的内容)从
而保证定时地解决冲突。它们通常用于保持集群的实际状态与内存中的缓
存的状态一致(代码
Bug
或是网络问题可能会导致它们不一致)。
工作队列
事件处理器把状态变化情况放入工作队列,用于保证在必要时可以进行重
试。在
client-go
中,这个功能是通过
workqueue
包(参考第
3
章“工作
队列”)来提供的。当在对资源或外部系统进行变更或者更新状态(控制
循环中的第
2
步和第
3
步)时发生错误,资源可以被重新放回工作队列,
它也可以被用于其他不能实时处理的状态变化的情况,把相关资源放入队
列后便可以在稍晚些时候再次处理。
有关
Kubernetes
的声明式处理引擎和状态变化的深入讨论,请参考
Andrew
Chen
Dominik Tornow
的“
The Mechanics of Kubernetes
”一文。
下面让我们一起来深入理解控制循环,先从
Kubernetes
的事件驱动架构开始。
1.4.2
事件
Kubernetes
的控制平面重度依赖事件处理和松耦合的组件架构。其他很多分
布式系统都使用远程过程调用(
RPC
)来触发一个动作,但
Kubernetes
不是
这样。
Kubernetes
的控制器会通过
API
服务器来观察
Kubernetes
对象的变化
情况
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

解密金融数据

解密金融数据

Justin Pauley
Python机器学习案例精解

Python机器学习案例精解

Posts & Telecom Press, Yuxi (Hayden) Liu
软件开发实践:项目驱动式的Java开发指南

软件开发实践:项目驱动式的Java开发指南

Raoul-Gabriel Urma, Richard Warburton

Publisher Resources

ISBN: 9787519854799