Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin第一版迭代:dubboctl 部分 #1178

Open
chickenlj opened this issue Jul 3, 2023 · 3 comments
Open

Admin第一版迭代:dubboctl 部分 #1178

chickenlj opened this issue Jul 3, 2023 · 3 comments

Comments

@chickenlj
Copy link
Contributor

下载&安装 dubboctl

支持下载压缩包
curl -L https://dubbo.apache.org/downloadAdmin | sh -
cd admin-0.5.0
export PATH=$PWD/bin:$PATH

安装组件

目标

  • 输出一个参考文档:包含profile说明、component 列表与启用说明、components 配置项覆盖说明等
  • Admin 需要的权限在helm中是否已经设置好?
  • 基本安装,提供 default、demo 两个 profiles
    • dubboctl install
    • dubboctl install --profile=demo

准备内容

  1. 完成 dubboctl 中所安装组件,到 admin 中 helm chart values 配置的注入,比如:
  prometheus:
    address: prometheus.dubbo-system.svc.cluster.local:3000
  grafana:
    address: grafana.dubbo-system.svc.cluster.local

使用

访问 Admin:安装后,port-forward,可直接访问 localhost:38080

knative func/dubbogo-cli

下一阶段探索

  • create project template
  • build
  • deploy
@DMwangnima
Copy link

dubboctl dashboard已实现。
支持Admin, Grafana, Nacos, Prometheus, Skywalking, Zipkin.
#1197

@DMwangnima
Copy link

已提供default与demo profile。
#1198

@DMwangnima
Copy link

DMwangnima commented Jul 15, 2023

dubboctl初版用户文档,需要详细描述profile字段。

dubboctl用户文档

概念

manifest

Dubbo-admin作为控制面中心组件,需要拉起Grafana,Prometheus,Skywalking,Zipkin,Nacos,Zookeeper等组件提供额外功能。在k8s环境下,描述各组件的配置yaml被称为manifest,也是dubboctl处理后的最终结果,可以配合kubectl等工具直接拉起所需组件。

dubboctl利用Helm api渲染各组件的Helm Chart得到manifest,其中Admin和Nacos的Helm Chart由Dubbo-admin社区维护,其余成熟组件直接使用官方提供的Helm Chart。(Helm工作原理请参考https://helm.sh/zh/docs/)

DubboConfig yaml(profile)

DubboConfig yaml与profile本质是格式与字段意义完全相同的yaml配置文件,因作用不同将两者分离开来。其中DubboConfig yaml面向用户,代表自定义需求;而profile由Dubbo-admin提炼和提供(用户也可设置自定义profile),代表各场景下的基础配置,用来减少用户的自定义配置量,目前社区提供了default与demo两种profile。

一个典型的DubboConfig yaml如下所示:

# DubboConfig example
apiVersion: dubbo.apache.org/v1alpha1
kind: DubboConfig
metadata:
  namespace: dubbo-system
spec:
  # kubectl基础元数据
  
  # profile指定需要使用的基础默认配置,若使用Dubbo-admin提供的profile
  # 目前可指定default与demo;
  profile: default
  namespace: dubbo-system
  
  # 配置组件的元数据,对于Dubbo-admin维护的组件,可配置enabled
  # 其余成熟组件还可配置仓库的地址和Helm Chart版本
  componentsMeta:
    # Dubbo-admin维护的组件
    admin:
      enabled: true
    # 成熟组件
    grafana:
      enabled: true
      repoURL: https://grafana.github.io/helm-charts
      version: 6.52.4
      
  # 配置各组件,其中admin与grafana字段中的值最终将映射到
  # 各组件对应Helm Chart的values.yaml
  components:
    admin:
      replicas: 2
    grafana:
      testFramework:
        enabled: true

default profile如下所示:

apiVersion: dubbo.apache.org/v1alpha1
kind: DubboOperator
metadata:
  namespace: dubbo-system
spec:
  profile: default
  namespace: dubbo-system
  # default profile默认拉起admin与zookeeper
  componentsMeta:
    admin:
      enabled: true
    zookeeper:
      enabled: true
      repoURL: https://charts.bitnami.com/bitnami
      version: 11.1.6

demo profile如下所示:

apiVersion: dubbo.apache.org/v1alpha1
kind: DubboOperator
metadata:
  namespace: dubbo-system
spec:
  profile: demo
  namespace: dubbo-system
  # demo profile默认拉起所有组件
  componentsMeta:
    admin:
      enabled: true
    grafana:
      enabled: true
      repoURL: https://grafana.github.io/helm-charts
      version: 6.52.4
    nacos:
      enabled: true
    zookeeper:
      enabled: true
      repoURL: https://charts.bitnami.com/bitnami
      version: 11.1.6
    prometheus:
      enabled: true
      repoURL: https://prometheus-community.github.io/helm-charts
      version: 20.0.2
    skywalking:
      enabled: true
      repoURL: https://apache.jfrog.io/artifactory/skywalking-helm
      version: 4.3.0
    zipkin:
      enabled: true
      repoURL: https://openzipkin.github.io/zipkin
      version: 0.3.0

可以看到DubboConfig由三部分组成,dubboctl元数据,componentsMeta,components。其中dubboctl元数据可指定profile,componentsMeta用于控制组件的开关以及成熟组件的仓库地址和版本。这里重点分析下components,manifest一节提到dubboctl利用Helm api渲染Helm Chart,各chart所需的values.yaml则由components中各组件的字段值一一映射而来。举例来说,components.admin的字段值将完全映射到Dubbo-admin chart的values.yaml(https://github.com/apache/dubbo-admin/blob/refactor-with-go/deploy/charts/dubbo-admin/values.yaml)。

Overlay

profile作为基础配置项,可以通过Overlay机制将用户自定义DubboConfig yaml作用在profile上,例如将DubboConfig yaml一节中的DubboConfig示例Overylay在 default profile上,得到结果:

# DubboConfig example
apiVersion: dubbo.apache.org/v1alpha1
kind: DubboConfig
metadata:
  namespace: dubbo-system
spec:
  # kubectl基础元数据
  
  # profile指定需要使用的基础默认配置,若使用Dubbo-admin提供的profile
  # 目前可指定default与demo;
  profile: default
  namespace: dubbo-system
  
  # 配置组件的元数据,对于Dubbo-admin维护的组件,可配置enabled
  # 其余成熟组件还可配置仓库的地址和Helm Chart版本
  componentsMeta:
    # Dubbo-admin维护的组件
    admin:
      enabled: true
    # 成熟组件
    grafana:
      enabled: true
      repoURL: https://grafana.github.io/helm-charts
      version: 6.52.4
    zookeeper:
      enabled: true
      repoURL: https://charts.bitnami.com/bitnami
      version: 11.1.6
      
  # 配置各组件,其中admin与grafana字段中的值最终将映射到
  # 各组件对应Helm Chart的values.yaml
  components:
    admin:
      replicas: 2
    grafana:
      testFramework:
        enabled: true

Overlay目前使用JSON Merge Patch(https://datatracker.ietf.org/doc/html/rfc7396)。

profile详细配置

命令

dubboctl manifest generate

生成所需组件的manifest,典型用例为:

dubboctl manifest generate | kubectl apply -f -
参数 速记 描述 示例 必需
--filenames -f 指定一个或多个用户自定义的DubboConfig yaml路径,解析时按照从左至右的顺序依次Overlay dubboctl manifest generate -f path/to/file0.yaml, path/to/file1.yaml
--charts 存放Helm Charts的目录,若用户不指定,默认使用/deploy/charts dubboctl manifest generate --charts path/to/charts
--profiles 存放profiles的目录,若用户不指定,默认使用/deploy/profiles dubboctl manifest generate --profiles path/to/profiles
--set -s 设置一个或多个DubboConfig yaml中的键值对,优先级上set flags > 用户自定义DubboConfig yaml > profile,生产上建议不使用set dubboctl manifest generate --set components.admin.replicas=2,components.admin.rbac.enabled=false
--output -o 指定最终生成manifest的输出路径,如果不设置,则默认输出到控制台 dubboctl manifest generate -o path/to/target/directory

dubboctl manifest install

直接向k8s集群安装所需组件,典型用例为:

dubboctl manifset install
参数 速记 描述 示例 必需
--filenames -f 指定一个或多个用户自定义的DubboConfig yaml路径,解析时按照从左至右的顺序依次Overlay dubboctl manifest install -f path/to/file0.yaml, path/to/file1.yaml
--charts 存放Helm Charts的目录,若用户不指定,默认使用/deploy/charts dubboctl manifest install --charts path/to/charts
--profiles 存放profiles的目录,若用户不指定,默认使用/deploy/profiles dubboctl manifest install --profiles path/to/profiles
--set -s 设置一个或多个DubboConfig yaml中的键值对,优先级上set flags > profile > 用户自定义DubboOperator yaml,生产上建议不使用set dubboctl manifest install --set components.admin.replicas=2,components.admin.rbac.enabled=false
--ku beConfig 存放kubeconfig的路径 dubboctl manifest install --kubeConfig path/to/kubeConfig
--context 指定使用kubeconfig中的context dubboctl manifest install --context contextVal

dubboctl manifest diff

展示两个manifest的不同处,将manifest拆分成多个k8s对象,对namespace:kind:name相同的对象进行比较,并输出manifest中多余的对象和解析错误的对象;若展示两个目录的不同处,则对名字相同的manifest进行上述处理,并输出目录中多余的manifest和解析错误的manifest。

典型用例为:

dubboctl manifest diff path/to/file0 path/to/file1

其中,两个manifest路径是必需的。

参数 速记 描述 示例 必需
--compareDir 比较两个目录中的manifest dubboctl manifest diff path/to/dir0 path/to/dir1 --compareDir

dubboctl manifest uninstall

卸载指定组件,目前暂不支持无条件卸载(意味着用户在不清楚dubboctl manifest intall使用的DubboConfig yaml或set参数,无法强制删除,需要使用kubectl等工具进行删除)。典型用例为:

dubboctl manifest uninstall
参数 速记 描述 示例 必需
--filenames -f 指定一个或多个用户自定义的DubboConfig yaml路径,解析时按照从左至右的顺序依次Overlay dubboctl manifest uninstall -f path/to/file0.yaml, path/to/file1.yaml
--charts 存放Helm Charts的目录,若用户不指定,默认使用/deploy/charts dubboctl manifest uninstall --charts path/to/charts
--profiles 存放profiles的目录,若用户不指定,默认使用/deploy/profiles dubboctl manifest uninstall --profiles path/to/profiles
--set -s 设置一个或多个DubboConfig yaml中的键值对,优先级上set flags > profile > 用户自定义DubboOperator yaml dubboctl manifest uninstall --set components.admin.replicas=2,components.admin.rbac.enabled=false
--ku beConfig 存放kubeconfig的路径 dubboctl manifest uninstall --kubeConfig path/to/kubeConfig
--context 指定使用kubeconfig中的context dubboctl manifest uninstall --context contextVal

dubboctl profile list

展示profiles目录下有哪些profile,以及展示指定profile的内容。典型用例为:

dubboctl profile list

dubboctl profile list default
参数 速记 描述 示例 必需
--profiles 指定存放profiles的目录 dubboctl profile list --profiles path/to/profiles

dubboctl profile diff

展示两个profile的不同之处。典型用例为:

dubboctl profile diff default demo
参数 速记 描述 示例 必需
--profiles 指定存放profiles的目录 dubboctl profile diff profile_name0 profile_name1 --profiles path/to/profiles

dubboctl dashboard admin

创建到Admin dashboard的port-forward(需要组件已启动),自动打开浏览器并跳转到dashboard。典型用例:

dubboctl dashboard admin
参数 速记 描述 示例 必需
--port -p 设置本地监听连接的端口,若不设置,则默认和Admin dashboard一致,8080 dubboctl dashboard admin -p 8888
--host -h 设置本地监听连接的主机,若不设置,则默认为127.0.0.1 dubboctl dashboard admin -h xxx.xxx.xxx.xxx
--openBrowser 设置是否自动打开浏览器并打开dashboard,默认为true dubboctl dashboard admin --openBrowser false
--namespace n 设置Admin所在的namespace,若不设置,则默认为dubbo-system dubboctl dashboard admin -n ns_user_specified
--ku beConfig 存放kubeconfig的路径 dubboctl dashboard admin --kubeConfig path/to/kubeConfig
--context 指定使用kubeconfig中的context dubboctl dashboard admin --context contextVal

dubboctl dashboard grafana

创建到Grafana dashboard的port-forward(需要组件已启动),自动打开浏览器并跳转到dashboard。典型用例:

dubboctl dashboard grafana
参数 速记 描述 示例 必需
--port -p 设置本地监听连接的端口,若不设置,则默认和Grafana dashboard一致,3000 dubboctl dashboard grafana -p 8888
--host -h 设置本地监听连接的主机,若不设置,则默认为127.0.0.1 dubboctl dashboard grafana -h xxx.xxx.xxx.xxx
--openBrowser 设置是否自动打开浏览器并打开dashboard,默认为true dubboctl dashboard grafana --openBrowser false
--namespace n 设置Grafana所在的namespace,若不设置,则默认为dubbo-system dubboctl dashboard grafana -n ns_user_specified
--ku beConfig 存放kubeconfig的路径 dubboctl dashboard grafana --kubeConfig path/to/kubeConfig
--context 指定使用kubeconfig中的context dubboctl dashboard grafana --context contextVal

dubboctl dashboard nacos

创建到Nacos dashboard的port-forward(需要组件已启动),自动打开浏览器并跳转到dashboard。典型用例:

dubboctl dashboard nacos
参数 速记 描述 示例 必需
--port -p 设置本地监听连接的端口,若不设置,则默认和Nacos dashboard一致,8848 dubboctl dashboard nacos -p 8848
--host -h 设置本地监听连接的主机,若不设置,则默认为127.0.0.1 dubboctl dashboard nacos -h xxx.xxx.xxx.xxx
--openBrowser 设置是否自动打开浏览器并打开dashboard,默认为true dubboctl dashboard nacos --openBrowser false
--namespace n 设置Nacos所在的namespace,若不设置,则默认为dubbo-system dubboctl dashboard nacos -n ns_user_specified
--ku beConfig 存放kubeconfig的路径 dubboctl dashboard nacos --kubeConfig path/to/kubeConfig
--context 指定使用kubeconfig中的context dubboctl dashboard nacos --context contextVal

dubboctl dashboard prometheus

创建到Prometheus dashboard的port-forward(需要组件已启动),自动打开浏览器并跳转到dashboard。典型用例:

dubboctl dashboard prometheus
参数 速记 描述 示例 必需
--port -p 设置本地监听连接的端口,若不设置,则默认和Prometheus dashboard一致,9090 dubboctl dashboard prometheus -p 9090
--host -h 设置本地监听连接的主机,若不设置,则默认为127.0.0.1 dubboctl dashboard prometheus -h xxx.xxx.xxx.xxx
--openBrowser 设置是否自动打开浏览器并打开dashboard,默认为true dubboctl dashboard prometheus --openBrowser false
--namespace n 设置Prometheus所在的namespace,若不设置,则默认为dubbo-system dubboctl dashboard prometheus -n ns_user_specified
--ku beConfig 存放kubeconfig的路径 dubboctl dashboard prometheus --kubeConfig path/to/kubeConfig
--context 指定使用kubeconfig中的context dubboctl dashboard prometheus --context contextVal

dubboctl dashboard skywalking

创建到Skywalking dashboard的port-forward(需要组件已启动),自动打开浏览器并跳转到dashboard。典型用例:

dubboctl dashboard skywalking
参数 速记 描述 示例 必需
--port -p 设置本地监听连接的端口,若不设置,则默认和Skywalking dashboard一致,8080 dubboctl dashboard skywalking -p 8888
--host -h 设置本地监听连接的主机,若不设置,则默认为127.0.0.1 dubboctl dashboard skywalking -h xxx.xxx.xxx.xxx
--openBrowser 设置是否自动打开浏览器并打开dashboard,默认为true dubboctl dashboard skywalking --openBrowser false
--namespace n 设置Skywalking所在的namespace,若不设置,则默认为dubbo-system dubboctl dashboard skywalking -n ns_user_specified
--ku beConfig 存放kubeconfig的路径 dubboctl dashboard skywalking --kubeConfig path/to/kubeConfig
--context 指定使用kubeconfig中的context dubboctl dashboard skywalking --context contextVal

dubboctl dashboard zipkin

创建到Zipkin dashboard的port-forward(需要组件已启动),自动打开浏览器并跳转到dashboard。典型用例:

dubboctl dashboard zipkin
参数 速记 描述 示例 必需
--port -p 设置本地监听连接的端口,若不设置,则默认和Zipkin dashboard一致,9411 dubboctl dashboard zipkin -p 8888
--host -h 设置本地监听连接的主机,若不设置,则默认为127.0.0.1 dubboctl dashboard zipkin -h xxx.xxx.xxx.xxx
--openBrowser 设置是否自动打开浏览器并打开dashboard,默认为true dubboctl dashboard zipkin --openBrowser false
--namespace n 设置Zipkin所在的namespace,若不设置,则默认为dubbo-system dubboctl dashboard zipkin -n ns_user_specified
--ku beConfig 存放kubeconfig的路径 dubboctl dashboard zipkin --kubeConfig path/to/kubeConfig
--context 指定使用kubeconfig中的context dubboctl dashboard zipkin --context contextVal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants