
keikoproj/addon-managerAddons是Kubernetes集群中的关键组件,提供应用所需的关键服务,如DNS、Ingress、监控、日志等。Addon Manager通过自定义资源定义(CRD)和Argo Workflows实现此类Addon的生命周期管理。
使用以下命令安装Addon Manager:
bashkubectl kustomize github.com/keikoproj/addon-manager.git/config/default | kubectl apply -f -
Addon CRD定义了Addon的规范,包含必填和可选字段,以及生命周期阶段。以下是Addon CRD的设计规范示例:
yamlapiVersion: addonmgr.keikoproj.io/v1alpha1 kind: Addon metadata: name: fluentd-addon namespace: addon-manager-system spec: pkgName: core/fluentd pkgVersion: v0.0.1 pkgType: composite pkgDescription: 公司Fluentd插件。 pkgDeps: argoproj/workflows: v2.2.1 params: namespace: mynamespace clusterContext: clusterName: "my-test-cluster" clusterRegion: "us-west-2" data: hec_splunk_server: hec.splunk.example.com selector: matchLabels: app.kubernetes.io/name: fluentd app.kubernetes.io/version: "1.0.0" lifecycle: prereqs: template: | apiVersion: argoproj.io/v1alpha1 kind: Workflow ... install: template: | apiVersion: argoproj.io/v1alpha1 kind: Workflow ... delete: template: | apiVersion: argoproj.io/v1alpha1 kind: Workflow ... validate: template: | apiVersion: argoproj.io/v1alpha1 kind: Workflow ...
使用以下命令提交Addon定义:
bashkubectl apply -f addon.yaml
Addon生命周期包含4个阶段(prereqs、install、validate、delete),每个阶段包含Name、Role和Template字段。Template需指定为内联Argo Workflow,用于定义该阶段的Kubernetes资源操作。
示例:prereqs阶段Workflow模板
yamlprereqs: template: | apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: prereqs-minion-manager- spec: entrypoint: entry serviceAccountName: addon-manager-workflow-installer-sa templates: - name: entry steps: - - name: prereq-resources template: submit arguments: artifacts: - name: doc path: /tmp/doc raw: data: | apiVersion: v1 kind: Namespace metadata: name: "{{workflow.parameters.namespace}}" --- apiVersion: v1 kind: ServiceAccount metadata: name: example-sa namespace: "{{workflow.parameters.namespace}}" - name: submit inputs: artifacts: - name: doc path: /tmp/doc container: image: expert360/kubectl-awscli:v1.11.2 command: [sh, -c] args: ["kubectl apply -f /tmp/doc"]
Addon Manager会将spec.params中的键值对转换为全局工作流参数,可在Workflow模板中通过{{workflow.parameters.NAME}}引用。引用时需注意使用引号转义,避免解析错误。
spec.params.namespace指定并在Workflow中模板化bashkubectl get addons -n addon-manager-system NAME PACKAGE VERSION STATUS AGE addon-manager-argo-addon addon-argo-workflow v2.2.1 Succeeded 14m cluster-autoscaler cluster-autoscaler-addon v0.1 Pending 1m event-router event-router v0.2 Pending 1m external-dns external-dns v0.2 Pending 1m fluentd core/fluentd-addon v0.0.1 Pending 1m ...
bashkubectl delete -f addon.yaml
Addon Manager附带addonctl二进制工具,支持基于参数YAML文件和Python脚本生成默认Addon CR。目前为Pre-alpha版本,主要用于初始Addon生成,生成后可手动修改。
bashaddonctl --help
命令输出:
bashA control plane for managing addons Usage: addonctl [command] Available Commands: create Create the addon resource with the supplied arguments help Help about any command Flags: -c, --channel string Channel for the addon package --cluster-name string Name of the cluster context being used --cluster-region string Cluster region --deps string Comma seperated dependencies list in the format 'pkgName:pkgVersion' --desc string Description of the addon --dryrun Outputs the addon spec but doesn't submit -h, --help help for addonctl --install string File or directory of resource yaml to submit as install step -n, --namespace string Namespace where the addon will be deployed -p, --params string Params to supply to the resource yaml --prereqs string File or directory of resource yaml to submit as prereqs step --secrets string Comma seperated list of secret names which are validated as part ofthe addon-manager-system namespace --selector string Selector applied to all resources? -t, --type string Addon package type -v, --version string Addon package version Use "addonctl [command] --help" for more information about a command.
bashaddonctl create my-addon -n my-addon-ns \ --type composite \ --version v0.2 \ --cluster-name my.cluster.k8s.local \ --cluster-region us-west-2 \ --selector app:myaddon \ --prereqs ./prereq_resources.yaml \ --install ./install_resources.yaml \ --dryrun
请参阅CONTRIBUTING.md。
请参阅DEVELOPER.md。
Instance Manager - Kube Forensics - Active Monitor - Upgrade Manager - Minion Manager - Governor



manifest unknown 错误
TLS 证书验证失败
DNS 解析超时
410 错误:版本过低
402 错误:流量耗尽
身份认证失败错误
429 限流错误
凭证保存错误
来自真实用户的反馈,见证轩辕镜像的优质服务