Git Product home page Git Product logo

k8sframework's Introduction

目录

TarsCloud K8SFramework

TarsCloud K8SFramework 是为了将 Tars 部署在 Kubernetes 集群而做的适应性改造项目.
TarsCloud K8SFramework 提供了包括部署,升级,回滚,、伸缩容,配置变更的在内的 Tars 服务全生命周期管理.
借助 TarsCloud K8SFramework, Tars 服务可以无缝运行在公有云或私有部署的 Kubernetes 集群.

设计

TarsCloud K8SFramework 使用 Kubernetes Operator 模式支持 Tars 服务在 Kubernetes 集群的部署和运维.
具体由 CRD, Controller, Framework 三部分组成, 其关系如下:

CRD

crd 是我们在 Kubernetes 集群中增加的一些自定义资源类型, 每种资源类型都抽象了 Tars 框架的概念或动作,
对这些资源执行 "增删改查" 操作, 就是对 Tars 框架的查询,管理和运维. crd 类型有:

  • tserver: tserver 抽象了 tars 服务属性, 每个 tserver 对象代表着一项 tars 服务.
  • tconfig: tconfig 抽象了 tars 服务配置属性, 每个 tconfig 对象代表一项 tars 服务配置.
  • ttemplate: ttemplate 抽象了 tars 服务模板属性, 每个 ttemplate 对象代表了一项 tars 模板.
  • taccount: taccount 抽象了 tarsweb 用户, 每个 taccount 对象代表一个 tarsweb 账号.
  • timage: timage 抽象了 tars 服务版本发布, 每个 timage 对象都记录了其关联 tars 服务已发布版本,发布时间,镜像地址,镜像密钥等信息.
  • tendpoint: tendpont 抽象了 tars 服务运行状态, 每个 tendpoint 对象都记录了其关联 tserver 的运行实时运行状态.
  • texitedrecord: texitedrecord 抽象了 tars 服务的退出状态, 每个 texitedrecord 对象都记录了其关联 tserver pods 的生命周期信息
  • tframeworkconfig: 每套tars 框架其只有唯一的 tframeworkconfig 对象, 用于记录 tars 框架级别的配置信息
  • ttree: 每套 tars 集群且其只有唯一的 ttree 对象, 用于记录 tars business 与 tars app 的关联信息

Controller

controller 是 Kubernetes Operator 模式的核心. 主要职责有:

  • 校验 crd 对象值合法性, 填充默认值, 添加,删除对象标签值
  • 持续监听 crd 对象的 "增删查改" 操作, 并将调谐成 Kubernetes 原生对象(statefulset,daemonset,service)
  • 提供 crd 版本兼容转换服务

Framework

framework 是指 tars 框架中的基础服务, 相比原生 tars 框架, TarsCloud Kubernetes 增删了部分服务,其清单和功能说明如下:

  • elasticsearch: 单节点 elasticsearch 服务, 替代原生 Tars 中的 MySql, 用于存储服务监控,特性监控,消息通知等信息
  • tarsweb: 提供运维管理平台服务
  • tarsregistry: 提供注册中心服务
  • tarsconfig: 提供配置中心服务
  • tarsnotify: 提供消息中心服务
  • tarslog : 提供日志中心服务
  • tarsproperty, tarsqueryproperty: 提供特性监控数据汇聚和查询服务
  • tarsstat, tarsquerystat: 提供的服务监控数据汇聚和查询服务
  • tarsimage, tarskaniko: 提供镜像构建服务
  • tarskevent: 提供 kubernetes 集群的 event 监听服务
  • tarsnode: 节点守护程序

每个 Kubernetes 集群只可以部署一套 CRD 和 Controller, 可以在不同的命名空间分别部署 Framework. 每套 Framework 互相独立, 等价一套原生 Tars 集群

特性

TarsCloud K8SFramework 特性介绍请参考 <<特性>>

安装与升级

TarsCloud K8SFramework 以 Helm Cart 的形式对外发布
您可以参考 <<安装>> 进行安装
您可以参考 <<升级>> 进行升级

运维

TarsCloud K8SFramework 支持两种运维管理方式
普通开发部署人员 可以通过 <<管理平台>> 进行运维管理
Kubernetes 集群管理员可以通过<<云原生运维>> 进行运维管理

开发者

做为开发者
您可以参考 <<构建>> 进行构建 您可以参考 <<开发>> 进行开发

贡献

我们欢迎任何形式的贡献,包括但不限于代码,文档,建议等
您可以通过 Tars社区, Issue, Pr 等任意可用方式与我们沟通交流

Todo

  • Tars SSL 支持:
    当前 TarsCloud K8SFramework 未支持 Tars SSL, 我们会在后续版本提供支持

  • Tars Set 支持 当前 TarsCloud K8SFramework 未支持 Tars Set, 我们会在后续版本提供支持

  • 文档计划 我们会逐步增加 TarsCloud K8SFramework 项目的文档

  • 测试案例 我们会逐步增加 TarsCloud K8SFramework 项目的测试案例, 包括针对 tarscontroller ,tarsframework ,helm安装,升级,降级的自动化测试

  • Tars DCache 支持 当前 TarsCloud K8SFramework 未支持 Tars DCache, 我们会在后续版本提供支持

  • 调试工具 Pod 中的服务调试运行比较困难,我们将会在基础镜像中添加 DebugTools, 便于在 Pod 中排查故障

  • 迁移工具 您可能有很历史服务需要迁移部署到TarsCloud K8SFramework , 我们将会在项目添加迁移工具

k8sframework's People

Contributors

ardingchen avatar lbbniu avatar ruanshudong avatar wenbinye avatar zhixiongdu027 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

k8sframework's Issues

TServer reconcile 频繁发生错误

在 tarscontoller 日志中出现很多这样的错误:

E1217 12:36:04.627593       1 tserver.go:160] patch tserver tars-test/chain-marketing error: Operation cannot be fulfilled on tservers.k8s.tars.io "chain-marketing": the object has been modified; please apply your changes to the latest version and try again
E1217 12:36:16.271580       1 tendpoint.go:292] update tendpoint tars-dev/chain-marketing error: Operation cannot be fulfilled on tendpoints.k8s.tars.io "chain-marketing": the object has been modified; please apply your changes to the latest version and try again

出现这种错误后就会出现 Pod 重新创建:
截屏2021-12-18 上午9 56 53

请问出现这种错误的原因是什么?可以避免吗?

如何给应用传参

问题描述
本人在学习按照官方文件制作业务docker镜像
exec-build.sh tarscloud/tars.cppbase:v1.0.0 cpp build/bin/StorageServer yaml/values.yaml v1.0.0 true

文档里说build/bin/StorageServer参数也可以替换成目录,假设目录里还有一个配置文件,需要执行StorageServer -c StorageCfg运行,该如何实现
build/bin/StorageServer
build/bin/StorageCfg

为什么要限制同一个 Server 中不同 Servant 监听端口号不允许重复

在 tarscontroller 中会检查 servant 端口号必须不同,这是出于什么考虑?
同一个应用服务,可能会提供不同服务接口,使用不同的 servant 名字,但是可以在同一个监听端口中处理的。现在强制端口号不同,服务端需要启动多个监听端口,客户端也不能重用连接。想了解一下有什么必要需要做这个验证?

线上运营稳定不

想把原生的tars改成这套k8s的,不知道实际稳定状况如何
看最近提交频率也较少了,支持继续完善

TConfig节点配置文件不生效

版本

https://raw.githubusercontent.com/TarsCloud/K8SFramework/master/charts/tarscontroller-1.4.0.tgz
https://raw.githubusercontent.com/TarsCloud/K8SFramework/master/charts/tarsframework-1.4.0.tgz

server-config.yaml

apiVersion: k8s.tars.io/v1beta2
app: ***
configContent: |-
  {}
configName: test.json
kind: TConfig
metadata:
  labels:
    tars.io/ConfigName: test.json
    tars.io/PodSeq: m
    tars.io/ServerApp: ***
    tars.io/ServerName: ***
  name: f8862d3342e20ceb030fbe438666ae62
  namespace: tars
podSeq: m
server: ***

pod-config.yaml

apiVersion: k8s.tars.io/v1beta2
app: ***
configContent: |
  {"a": 1}
configName: test.json
kind: TConfig
metadata:
  labels:
    tars.io/ConfigName: test.json
    tars.io/PodSeq: '1'
    tars.io/ServerApp: ***
    tars.io/ServerName: ***
  name: eab62c6708825cdf6458ed248270cbf5
  namespace: tars
podSeq: '1'
server: ***

实际结果

在pod-1中cat 配置文件test.json得到

{}

预期结果

在pod-1中cat 配置文件test.json得到

{"a": 1}

Ingress 使用的api resource版本已弃用

install/tarsframework/templates/tars-tarsweb.yaml line:139
ingress安装使用的api resource networking.k8s.io/v1beta1 在k8s v1.22 中已经弃用,使用helm进行快速安装时报错。

tars-elasticsearch 启动失败

elasticsearch 挂载失败
MountVolume.NewMounter initialization failed for volume "tars-dev-data-tars-elasticsearch-9ba1c2b" : path "/usr/local/app/tars/host-mount/tars-dev/tars.elasticsearch/data" does not

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.