嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元微信扫码支付:2 元
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
Operators are a way of packaging, deploying, and managing Kubernetes applications. A Kubernetes application doesn’t just run on Kubernetes; it’s composed and managed in Kubernetes terms. Operators add application-specific operational knowledge to a Kubernetes cluster, making it easier to automate complex, stateful applications and to augment the platform. Operators can coordinate application upgrades seamlessly, react to failures automatically, and streamline repetitive maintenance like backups.
Think of Operators as site reliability engineers in software. They work by extending the Kubernetes control plane and API, helping systems integrators, cluster administrators, and application developers reliably deploy and manage key services and components. Using real-world examples, authors Jason Dobies and Joshua Wood demonstrate how to use Operators today and how to create Operators for your applications with the Operator Framework and SDK.
- Learn how to establish a Kubernetes cluster and deploy an Operator
- Examine a range of Operators from usage to implementation
- Explore the three pillars of the Operator Framework: the Operator SDK, the Operator
- Lifecycle Manager, and Operator Metering
- Build Operators from the ground up using the Operator SDK
- Build, package, and run an Operator in development, testing, and production phases
- Learn how to distribute your Operator for installation on Kubernetes clusters
Table of Contents Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii 1. Operators Teach Kubernetes New Tricks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 How Kubernetes Works 1 Example: Stateless Web Server 3 Stateful Is Hard 4 Operators Are Software SREs 5 How Operators Work 5 Kubernetes CRs 6 How Operators Are Made 6 Example: The etcd Operator 7 The Case of the Missing Member 7 Who Are Operators For? 8 Operator Adoption 8 Let’s Get Going! 9 2. Running Operators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Setting Up an Operator Lab 11 Cluster Version Requirements 11 Authorization Requirements 12 Standard Tools and Techniques 13 Suggested Cluster Configurations 13 Checking Your Cluster Version 14 Running a Simple Operator 15 A Common Starting Point 15 Fetching the etcd Operator Manifests 16 CRs: Custom API Endpoints 16 Who Am I: Defining an Operator Service Account 17 vii Deploying the etcd Operator 19 Declaring an etcd Cluster 20 Exercising etcd 21 Scaling the etcd Cluster 22 Failure and Automated Recovery 23 Upgrading etcd Clusters 24 Cleaning Up 26 Summary 27 3. Operators at the Kubernetes Interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Standard Scaling: The ReplicaSet Resource 29 Custom Resources 30 CR or ConfigMap? 30 Custom Controllers 31 Operator Scopes 31 Namespace Scope 31 Cluster-Scoped Operators 32 Authorization 32 Service Accounts 32 Roles 33 RoleBindings 33 ClusterRoles and ClusterRoleBindings 33 Summary 34 4. The Operator Framework. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Operator Framework Origins 35 Operator Maturity Model 36 Operator SDK 36 Installing the Operator SDK Tool 37 Operator Lifecycle Manager 37 Operator Metering 38 Summary 39 5. Sample Application: Visitors Site. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Application Overview 41 Installation with Manifests 43 Deploying MySQL 43 Backend 45 Frontend 47 Deploying the Manifests 49 Accessing the Visitors Site 49 Cleaning Up 49 viii | Table of Contents Summary 50 6. Adapter Operators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Helm Operator 53 Building the Operator 53 Fleshing Out the CRD 57 Reviewing Operator Permissions 57 Running the Helm Operator 57 Ansible Operator 58 Building the Operator 58 Fleshing Out the CRD 60 Reviewing Operator Permissions 60 Running the Ansible Operator 60 Testing an Operator 61 Summary 62 Resources 62 7. Operators in Go with the Operator SDK. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 Initializing the Operator 64 Operator Scope 64 Custom Resource Definitions 66 Defining the Go Types 67 The CRD Manifest 68 Operator Permissions 68 Controller 69 The Reconcile Function 71 Operator Writing Tips 72 Retrieving the Resource 72 Child Resource Creation 73 Child Resource Deletion 76 Child Resource Naming 77 Idempotency 77 Operator Impact 78 Running an Operator Locally 79 Visitors Site Example 80 Summary 81 Resources 81 8. Operator Lifecycle Manager. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 OLM Custom Resources 83 ClusterServiceVersion 84 CatalogSource 84 Table of Contents | ix Subscription 85 InstallPlan 85 OperatorGroup 85 Installing OLM 86 Using OLM 88 Exploring the Operator 92 Deleting the Operator 93 OLM Bundle Metadata Files 94 Custom Resource Definitions 94 Cluster Service Version File 95 Package Manifest File 95 Writing a Cluster Service Version File 95 Generating a File Skeleton 95 Metadata 97 Owned CRDs 98 Required CRDs 101 Install Modes 102 Versioning and Updating 102 Writing a Package Manifest File 103 Running Locally 104 Prerequisites 104 Building the OLM Bundle 107 Installing the Operator Through OLM 109 Testing the Running Operator 111 Visitors Site Operator Example 111 Summary 111 Resources 111 9. Operator Philosophy. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 SRE for Every Application 113 Toil Not, Neither Spin 114 Automatable: Work Your Computer Would Like 114 Running in Place: Work of No Enduring Value 114 Growing Pains: Work That Expands with the System 115 Operators: Kubernetes Application Reliability Engineering 115 Managing Application State 116 Golden Signals Sent to Software 116 Seven Habits of Highly Successful Operators 118 Summary 119 10. Getting Involved. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 Feature Requests and Reporting Bugs 121 x | Table of Contents Contributing 122 Sharing Operators 123 Summary 123 A. Running an Operator as a Deployment Inside a Cluster. . . . . . . . . . . . . . . . . . . . . . . . . . 125 B. Custom Resource Validation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 C. Role-Based Access Control (RBAC). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133