权限说明
本文档详细说明了 SmartAgent Operator 在 Kubernetes 环境中运行所需的各项权限配置。根据不同的部署模式(全栈或仅监控应用),所需的资源和权限有所不同。文档将不同部署模式下涉及的 Kubernetes 资源及其权限要求进行分类说明,帮助用户正确配置权限以确保 SmartAgent 正常运行。
对于关注权限最小化的用户,文档中特别标注了 可选权限和 只读权限,便于您根据实际需求裁剪权限配置。
kubernetes.yaml(全栈或仅监控)
信息
【仅监控应用】:表示仅监控应用部署模式下所需的资源。
【全栈】:表示全栈部署模式下所需的资源。
【只读】:表示权限只包含 get、list、watch 等只读权限。
【写权限可选】:表示权限中的 create、update、patch 可去除。
【可选】:表示可去除有该标记的权限或资源。
| 资源类型 | 名称 | 说明 |
|---|---|---|
| CRD | smartkubes.bonree.com | 扩展 Kubernetes 资源类型,用于定义探针配置项,便于根据配置即时调整探针部署。 |
| Deployment | smartagent-operator | 监听 Kubernetes 自定义资源(SmartKube)配置变更,根据配置管理探针部署、记录部署状态和事件;更新密钥 Secret:bonree-webhook-certs(用于存储 Webhook 证书)等。 |
| ServiceAccount | smartagent-operator | 用于约束 Deployment:smartagent-operator 的权限。 |
| Role 【读写】 | smartagent-operator | 用于约束对指定命名空间 bonree-agent 的资源访问权限。 写权限:Daemonset、webhook 等组件管理。 |
| RoleBinding | smartagent-operator | 用于将 Role:smartagent-operator 与 ServiceAccount:smartagent-operator 绑定。 |
| ClusterRole ClusterRoleBinding | smartagent-operator | 用于约束对集群内资源的访问权限: **【可选】**写权限 |
| ServiceAccount 【全栈】 | bonree-smartkube-smartagent | **【可选】**用于增强 SmartAgent 全栈监控模式下采集 Kubernetes 属性。 |
| ClusterRole ClusterRoleBinding 【全栈】 | bonree-smartagent-enhance | **【可选】**用于增强 SmartAgent 全栈监控模式下采集 Kubernetes 属性: 服务 (service) 命名空间 UID (namespace UID) 所有者引用 (ownerReferences) Pod IP 地址 (podIps) |
| Deployment Service MutatingWebhookConfiguration 【仅监控应用】 | bonree-webhook | 详情见 kubernetes-webhook-only.yaml。 |
kubernetes-webhook-only.yaml(仅监控应用)
注意
注意:不支持通过 CSI Driver 提供探针。
信息
【只读】:表示权限只包含 get、list、watch 等只读权限。
【写权限可选】:表示权限中的 create、update、patch 可去除。
【可选】:表示可去除有该标记的权限或资源。
| 资源类型 | 名称 | 说明 |
|---|---|---|
| CRD(自定义资源) | smartkubes.bonree.com | 扩展 Kubernetes 资源类型(SmartKube),用于定义探针配置项,便于根据配置即时调整探针部署。 |
| Deployment Service MutatingWebhookConfiguration | bonree-webhook | 基于 Kubernetes Admission Webhooks,监听 Kubernetes 中 Pod 资源变更,根据 SmartKube 自定义资源配置修改 Pod 资源配置。对目标 Pod 追加 Init Container,用于部署 Serverless 探针及配置 LD_PRELOAD 等环境变量,实现自动注入探针。 |
| ServiceAccount | bonree-webhook | 用于约束 Deployment:bonree-webhook 的权限。 |
| Role 【读写】 【写权限可选】 | bonree-webhook | 用于约束对指定命名空间 bonree-agent 的资源访问权限。 **【可选】**写权限:events,用于记录 Serverless 探针注入事件至 SmartKube 资源实例中。 |
| RoleBinding | bonree-webhook | 用于将 Role:bonree-webhook 与 ServiceAccount:bonree-webhook 绑定。 |
| ClusterRole 【读写】 【写权限可选】 | bonree-webhook | 用于约束对集群内资源的访问权限: **【可选】**读写权限:secrets,用于在目标 Pod 所在命名空间中创建注入信息(包含探针的敏感配置信息),提供给 initContainer 访问。无该权限时,使用 env 代替。 |
| ClusterRoleBinding | bonree-webhook | 用于将 ClusterRole:bonree-webhook 与 ServiceAccount:bonree-webhook 绑定。 |
| Secret | bonree-webhook-certs | 存储 Webhook 服务私钥和证书。 |
kubernetes-csi.yaml [可选]
用于仅监控应用模式下,通过节点缓存 Serverless 探针,提供注入时使用的临时卷。
| 资源类型 | 名称 | 说明 |
|---|---|---|
| Daemonset | bonree-smartagent-csi-driver | 根据自定义资源(SmartKube)配置中的接口配置,按需缓存探针版本,提供必要的 CSI 驱动接口实现,使探针模块文件可以安全地挂载到 Pod 中,而无需修改应用容器的镜像或配置。 |
| ServiceAccount | bonree-smartagent-csi-driver | 用于约束 Daemonset:bonree-smartagent-csi-driver 的权限。 |
| Role **【读写】 | bonree-smartagent-csi-driver | 用于约束对指定命名空间 bonree-agent 的资源访问权限。写权限:endpoints,用于提供 CSI 接口。 |
| RoleBinding | bonree-smartagent-csi-driver | 用于将 Role:bonree-smartagent-csi-driver 与 ServiceAccount:bonree-smartagent-csi-driver 绑定。 |
| ClusterRole 【读写】 | bonree-smartagent-csi-driver | 用于约束对集群内资源的访问权限。写权限:events,用于创建挂载事件。 |
| ClusterRoleBinding | bonree-smartagent-csi-driver | 用于将 ClusterRole:bonree-smartagent-csi-driver 与 ServiceAccount:bonree-smartagent-csi-driver 绑定。 |
| CSIDriver | csi.smartagent.bonree.com | 用于为目标 Pod 提供包含 Serverless 探针文件的临时卷。 |
| PriorityClass | bonree-high-priority | 提升 Daemonset:bonree-smartagent-csi-driver Pod 的调度优先级。 |