operator系列文章:二、基本概念

看了自己列的9月份的计划,还差不少,不能如此佛系,加油哇!

https://kubernetes.io/docs/concepts/extend-kubernetes/operator/

感觉自己翻译不好的,我会贴上英文,自行理解

custom resources

  • k8s api的扩展包
  • 在k8s集群中增加一个custom resource,使用它作为一个独立的服务

operator

  • The Operator pattern aims to capture the key aim of a human operator who is managing a service or set of services. Human operators who look after specific applications and services have deep knowledge of how the system ought to behave, how to deploy it, and how to react if there are problems.
  • People who run workloads on Kubernetes often like to use automation to take care of repeatable tasks. The Operator pattern captures how you can write code to automate a task beyond what Kubernetes itself provides.
  • 核心目的:管理一个服务或者一组服务
  • 系统如何运行、部署、出现问题如何响应
  • operator pattern:通过代码实现,在k8s平台自动执行任务
  • Operators are clients of the Kubernetes API that act as controllers for a Custom Resource.

operator 例子

  • 根据你的需求,部署一个应用
  • 可以获取应用的状态,可以通过备份数据恢复应用
  • 可以对应用实现升级(数据库模式修改或者配置变化)
  • publishing a Service to applications that don’t support Kubernetes APIs to discover them
  • 模拟集群失败的情况,测试其鲁棒性
  • choosing a leader for a distributed application without an internal member election process

operator例子细节

  • 你自定义了一个资源SampleDB,然后把这个资源配置到了集群中
  • Pod使用这个SampleDB对应的控制器进行部署(类似于平台的Deployment)
  • 容器镜像有一个operator code
  • 控制器通过控制平面找到SampleDB资源被配置了
  • The core of the Operator is code to tell the API server how to make reality match the configured resources.
    • 增加了一个SampleDB类型的资源,控制器实现PVC的创建,设置一个SatefulSet来运行SampleDB,设置一个job来实现初始化配置
    • 删除资源,operator做一个snapshot,确保删除了statefulset和volume
  • operator也实现定期的数据备份,pod通过configmap或者secret
  • operator致力于custom resource的健壮的自动化管理,需要额外的一些代码来实现其自动化管理

部署operators

  • 增加custom resource definition和与之相关的控制器
    • 控制器可以运行在控制平面之外,比如可以通过kind为Deployment的方式运行控制器

使用operator

  • 可以增删查改operator(kind of resource)

实现operator

  • own cloud native operator
  • using language/runtime that can act as a client for the kubernetes
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值