实例介绍
【实例简介】
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
相关文章
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论