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编程
204
8
相似,在聚合自定义
API
服务器中,委托授权的逻辑基本上都是由
k8s.io/
apiserver
库自动实现的。
8.4
开发自定义
API
服务器
在前面的章节中,我们学习了聚合
API
服务器的架构。在这一部分,我们将
学习如何用
Golang
实现聚合自定义
API
服务器。
Kubernetes API
服务器是通过
k8s.io/apiserver
库实现的,自定义
API
服务器
也会用使用几乎相同的实现。主要的不同点在于我们的自定义
API
服务器
会在
Kubernetes
集群内运行。这意味着我们可以假设集群里有一个可用的
kube-apiserver
,并且可以用它来代理授权或获取其他
Kubernetes
原生资源。
我们同样可以假设集群中有可用的
etcd
,并且可以将其用于聚合自定义
API
服务器。这个
etcd
是否与
Kubernetes API
服务器共享的并不关键。我们的自
定义
API
服务器将使用一个不同的
etcd
键值空间来避免冲突。
本章的代码示例来自
GitHub
上的示例代码,可以从那里获取完整的源码。我
们在此只摘录感兴趣的部分,但是你可以在完整的示例项目中开展各种实验,
并在一个真实的集群里运行它,这样的实践对于学习新知识非常重要。
这个
pizza-apiserver
项目实现了“
8.2
示例:一个披萨店”中列出的示例
API
8.4.1
选项、配置模式和启动基础设施
k8s.io/apiserver
库使用一种“选项
-
配置”模式来创建一个可运行的
API
务器。
我们先来看看可以通过标记来配置的选项结构体。可以从
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