云原生|Operator本质
什么是 Operator
CoreOS 在 2016 年底提出了 Operator 的概念,当时的一段官方定义如下:
“An Operator represents human operational knowledge in software, to reliably manage an application.
什么是Controller Loop?
简单来说,Controller Loop是Controller动作的基础。想象一下,有一个非终止的进程(在Kubernetes中称为和解循环)在不断地发生,如下图所示:
这个过程至少观察一个Kubernetes对象,该对象包含有关所需状态的信息。比如:
- Deployment
- Services
- Secrets
- Ingress
- Config Maps
这些对象由JSON或YAML中的manifest组成的配置文件定义。然后controller根据内置逻辑,通过Kubernetes API进行持续调整,模仿所需状态,直到当前状态变成所需状态。
通过这种方式,Kubernetes通过处理不断的更改来处理Cloud Native系统的动态性质。为达到预期状态而执行的修改实例包括:
- 注意到节点宕机时,要求更换新的节点。
- 检查是否需要复制pods。
- 如果需要,创建一个新的负载均衡器。
Operator是一个特定应用程序的controller,它扩展了一个Kubernetes API,替代运维工程师或SRE工程师来创建、配置和管理复杂的应用程序。在Kubernetes官方文档中对此有以下描述:
Operator是Kubernetes的软件拓展,它利用自定义资源来管理应用程序及其组件。Operator遵循Kubernetes的原则,尤其遵循control loop。
到目前为止,你已经了解Operator会利用观察Kubernetes对象的controller。这些controller有点不同,因为它们正在追踪自定义对象,通常称为自定义资源(CR)。CR是Kubernetes API的扩展,它提供了一个可以存储和检索结构化数据的地方——你的应用程序的期望状态。整个操作原理如下图所示:
Operator会持续跟踪与特定类型的自定义资源相关的集群事件。可以跟踪的关于这些自定义资源的事件类型有:
- Add
- Update
- Delete
当Operator接收任何信息时,它将采取行动将Kubernetes集群或外部系统调整到所需的状态,作为其在自定义controller中的和解循环(reconciliation loop)的一部分。
Why are Operators different than other tools out there?
Operators are purpose-built to run a Kubernetes application, with operational knowledge baked in. They will be smarter and more tailored than generic tools.
The cloud-like capabilities that are encoded into the Operator code can provide an advanced user experience, automating such features as updates, backups and scaling. All of this is accomplished using standard Kubernetes tools, CLI and API.
What are benefits of using the Operator Framework?
If you are a community member, builder, consumer of applications, or a user of Kubernetes overall, the Operator Framework offers a number of benefits. Operators are built on top of a common set of Kubernetes APIs. They act like cloud services, make it more simple to install and update Kubernetes applications, without having to worry about the underlying platform.
Operators helps your teams to build a great automation experience. They allow teams to build in expertise of automated operations, instead of building manually each time.
How does the Operator Framework make hybrid cloud easier?
For consumers of applications across the hybrid cloud, keeping those applications up to date as new versions become available is of supreme importance, both for security reasons and for managing the applications’ lifecycles and other needs. The Operator Framework helps address these user requirements, aiding in the creation of cloud-native applications that are easier to consume, to keep updated, and to secure.
Who builds an Operator?
Operators are best built by those that are experts in the “business logic” of installing, running and upgrading an application.
Experience has shown that the creation of an Operator typically starts by automating an application’s installation and self-service provisioning capabilities, and then evolves to take on more complex automation.
Who deploys an Operator?
Operators are deployed by end-users through the Lifecycle Manager. Common patterns are for centralized infrastructure teams to grant access to a team’s Namespaces to run specific Operators. Afterwards, each team can manage, upgrade and scale their Operators in a self-service manner.
Operators can package internal applications at an enterprise, software that is deployed by commercial customers, or popular open source projects. Operators can even power a SaaS environment with a large amount of individual instances of an application.
Does an Operator require Kubernetes?
Yes, Kubernetes is required, but range of versions/distros are supported. The goal is to provide tooling to build Kubernetes applications, Operators, that are independent to a specific vendor or cloud platform.
Do I always need to write my own Operator to get value out of the Operator Framework?
You do not need to write your own Operator in order to get value out of the Operator Framework. Operators can be written such that they can be reused for applications. This means that you can, for example, create a generic Helm Operator that can be specialized for individual Charts. Even applications that do not require more than the built-in Kubernetes Workloads APIs can benefit from the lifecycle management and unified user-experience provided by the Operator Framework.
How do I join the community or help out?
All core components are part of a dedicated GitHub organization called “Operator Framework”. Please join the Operator Framework mailing list for discussion, questions and comments. Please also review and assist community operators as listed here and here.
https://developers.redhat.com/blog/2018/12/18/introduction-to-the-kubernetes-operator-framework/
https://coreos.com/operators/
https://www.openshift.com/blog/kubernetes-operators-best-practices?extIdCarryOver=true&sc_cid=701f2000001OH7EAAW
https://sdk.operatorframework.io/docs/building-operators/golang/tutorial/
https://book.kubebuilder.io/cronjob-tutorial/controller-overview.html
https://www.okd.io/
https://github.com/kubernetes-sigs/controller-tools
- Asp.Net MVC +EntityFramework主从表新增编辑操作的实现(删除操作怎么实现?)
- 模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板
- 洛谷P1311 选择客栈
- 洛谷P1607 [USACO09FEB]庙会班车Fair Shuttle
- R语言抓包实战——知乎live二级页面获取
- 左手用R右手Python系列——面向对象编程基础
- 线性同余同余方程组解法(excrt)
- #19. 计数(容斥原理)
- 左手用R右手Python系列——多进程/线程数据抓取与网页请求
- #15. 钻石
- P1328 生活大爆炸版石头剪刀布
- ASP.NET MVC 5 Authentication Breakdown
- jquery easyui datagrid mvc server端分页排序筛选的实现
- 左手用R右手Python系列——使用多进程进行任务处理
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- javaAPI操作hadoop hdfs
- java中各种距离换算
- SAP Spartacus HttpParamsURIEncoder单元测试文件备份
- 微PE制作U盘启动盘,并安装Win10
- Angular单元测试如何只执行指定的测试用例,提高测试速度
- 院长智能部署Frp内网穿透---支持多系统
- dotnet OpenXML 元素 cNvPr NonVisual Drawing Properties 重复 id 标识处理
- Magicodes.IE之花式导出
- vue列表点击切换颜色
- JVM加载过程科普
- 我没学过计算机,是怎么接了四个私活还挣了两个 iPad 的?
- Helm安装Prometheus Operator
- 【每日一题】【vue2源码学习】vue如何检测数组的变化
- JavaScript 实现输入框内容一键复制(附上 Vue 3 实现方式)
- python 迭代器/iterator与生成器/generator的区别