Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Jason Dobies, Joshua Wood

Rating No ratings yet

This practical book shows you how to use Operators to install some of the most essential core services on Kubernetes clusters with automated management and upgrades. Items such as permanent storage and databases can be complex to run on Kubernetes, because they often have their own notions of storage, networking, and clustering. Authors Josh Wood and Paul Bert explain how Operators know how to configure serious apps to work on your cluster, and how to keep them running over time, including upgrading them between versions.

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
# Kubernetes Operators: Automating the Container Orchestration Platform ## 【One-Line Pitch】 A practical guide for Kubernetes administrators and platform engineers who want to extend Kubernetes beyond stateless workloads by building and deploying Operators—custom controllers that automate the lifecycle of stateful applications like databases and storage systems. If you've struggled with running complex stateful services on Kubernetes, this book shows you how to encode operational expertise into software. ## 【Book Arc】 - **Opening (~0%–10%)**: Introduces the core problem—Kubernetes excels at stateless workloads but struggles with stateful applications that have their own storage, networking, and clustering requirements. Establishes the Operator pattern as the solution: custom controllers that understand an application's internal state and continuously reconcile it with desired state. - **Early (~10%–23%)**: Explains the foundational building blocks: Custom Resource Definitions (CRDs) as new API endpoints, the control plane vs. data plane architecture, and how control loops work. Walks through the etcd Operator as a concrete example, showing how it manages cluster membership, backups, and upgrades—tasks Kubernetes alone cannot handle. - **Early (~23%–32%)**: Covers the practical setup requirements: cluster-admin privileges, RBAC configuration, service accounts, and roles. Demonstrates deploying the etcd Operator step-by-step, including creating the CRD, service account, role, and deployment manifests. - **Middle (~32%–48%)**: Dives into hands-on operation: declaring an etcd cluster via a custom resource, watching the Operator create and manage pods, and triggering version upgrades by editing the CR spec. Shows how the Operator handles member failures and rolling upgrades automatically. - **Middle (~48%–52%)**: Continues with upgrade workflows, demonstrating both `kubectl edit` and `kubectl patch` approaches to change cluster versions, and covers cleanup procedures for removing Operator resources. - **Late (~52%–100%)**: Moves into the Operator Lifecycle Manager (OLM), covering installation, subscriptions, InstallPlans, OperatorGroups, and bundle metadata. Includes writing Cluster Service Version (CSV) files, package manifests, and running Operators locally for testing, concluding with Operator philosophy. ## 【Key Takeaways】 - **Operators are software SREs** (Early): They encode operational knowledge—backup procedures, upgrade paths, failure recovery—into code that runs continuously, rather than relying on human intervention or shell scripts. This is the fundamental shift from manual operations to automated lifecycle management. - **CRDs are the extension mechanism** (Early): Custom Resource Definitions, formalized in Kubernetes 1.7, let you create new API endpoints for site-specific resources. Combined with custom controllers, they form the basic Operator pattern: a controller watching and reconciling custom resources. - **Stateful applications need domain-specific logic** (Early): Unlike stateless web servers where any replica is interchangeable, stateful services like etcd require careful cluster membership management, endpoint configuration, and coordinated upgrades—things Kubernetes alone cannot infer. - **RBAC is essential for production Operators** (Early): While cluster-admin access is needed for initial deployment, production scenarios demand granular Role-Based Access Control with dedicated service accounts, roles, and bindings scoped to the resources an Operator manages. - **The etcd Operator demonstrates the pattern end-to-end** (Middle): Deploying it involves creating a CRD, service account, role, and deployment—then declaring an EtcdCluster with just `size` and `version` fields. The Operator handles everything else, including member recovery and version upgrades. - **Upgrades are declarative, not procedural** (Middle): Changing a single field in the CR spec (e.g., version from 3.1.10 to 3.3.12) triggers the Operator to orchestrate rolling upgrades across cluster members, recording each step in Kubernetes events. - **OLM standardizes Operator distribution** (Late): The Operator Lifecycle Manager provides a framework for packaging, installing, and updating Operators using Cluster Service Version files, package manifests, and bundle metadata—making Operators shareable and maintainable. ## 【Reading Tips】 - **Skim the early Kubernetes refresher** (~0%–10%) if you're already comfortable with pods, deployments, and control loops—the real value starts with the etcd Operator example. - **Deep-read the etcd Operator walkthrough** (~23%–48%): This is the heart of the book. Follow along with the manifests and commands to understand the full lifecycle: RBAC setup, deployment, cluster creation, failure recovery, and upgrades. - **Pay attention to the upgrade workflow** (~48%–52%): Understanding how version changes propagate through the Operator is critical for production use. Note the difference between `kubectl edit` and `kubectl patch` approaches. - **The OLM chapters** (~52%+) are essential if you plan to distribute Operators to others; skim them if you're only building Operators for internal use. - **Don't skip the RBAC discussion** (Early): Even though the book acknowledges you can start with cluster-admin, understanding service accounts and roles is crucial for secure production deployments. ## 【Coverage Limits】 This guide covers the book's progression from Operator fundamentals through the etcd example and into OLM packaging. The excerpts do not cover the later chapters on Operator philosophy in depth, nor do they include the appendices on RBAC details or the Visitors Site Operator example. ##
Page 6
of the authors, and do not represent the publisher’s views. While the publisher and the authors have used good faith efforts to ensure that the information a...
View in text
Page 12
. . . . . . . . . . . . . . . . . . . . . . . . . . . 113 SRE for Every Application 113 Toil Not, Neither Spin 114 Automatable: Work Your Computer Would Like...
View in text
Excerpt 3
1.2 introduced the API extension mechanism known as the CRD in elemental form as the third party resource (TPR). Since then, the components Operators build o...
View in text
Excerpt 4
3s You can also try kubectl edit etcdcluster/example-etcd- cluster to drop into an editor and make a live change to the clus‐ ter size. Failure and Automated...
View in text
Excerpt 5
ct.com/) • A database, using MySQL (https://www.mysql.com/) As shown in Figure 5-2, each of these components is deployed as a separate container. The flow is...
View in text
Excerpt 6
nts become optional. The api-version is defaulted to charts.helm.k8s.io/v1alpha1 and the kind name will be derived from the name of the chart. However, as th...
View in text
Excerpt 7
modifications to the VisitorsApp struct indicate that it is cluster-scoped: // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // Visitor...
View in text
Excerpt 8
al use cases, "myDeployment" is replaced with the same name the Operator used when the deployment was created, taking care to ensure uniqueness relative to t...
View in text
Tags
AI categories
Cloud NativeDevOpsBackend
ISBN: 1492048054
Publisher: O'Reilly Media
Publish Year: 2020
Language: English
Pages: 158
File Format: PDF
File Size: 6.3 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…