Merge pull request '补齐 sandbox PSAT reviewer 权限' (#90) from fix/sandbox-spire-psat-rbac into main
yaml / yaml (push) Successful in 16s
yaml / yaml (push) Successful in 16s
Reviewed-on: #90
This commit was merged in pull request #90.
This commit is contained in:
@@ -21,9 +21,9 @@ Root bootstrap 已完成。后续按依赖顺序分别引入:
|
|||||||
第一阶段监控拆为 `monitoring-operator` 与依赖它的 `monitoring`,防止 VM CR 在
|
第一阶段监控拆为 `monitoring-operator` 与依赖它的 `monitoring`,防止 VM CR 在
|
||||||
VictoriaMetrics Operator CRD Ready 前进入 reconciliation。
|
VictoriaMetrics Operator CRD Ready 前进入 reconciliation。
|
||||||
|
|
||||||
SPIRE 阶段先由 `spire-bootstrap` 安装 CRD,并声明只允许 `tokenreviews.create` 的
|
SPIRE 阶段先由 `spire-bootstrap` 安装 CRD,并声明按上游 k8s_psat Server plugin
|
||||||
central Server reviewer。Agent ServiceAccount 留给后续 HelmRelease 创建,避免两个
|
要求收窄的 reviewer:它可以调用 TokenReview,并只读查询用于证明的 Pod 与 Node。
|
||||||
声明方争夺同一资源。随后运行
|
Agent ServiceAccount 留给后续 HelmRelease 创建,避免两个声明方争夺同一资源。随后运行
|
||||||
`infrastructure/sandbox-cluster/ansible/spire-bootstrap.yml`:playbook 从 sandbox
|
`infrastructure/sandbox-cluster/ansible/spire-bootstrap.yml`:playbook 从 sandbox
|
||||||
读取 reviewer token,在内存中组成受限 kubeconfig,再通过 stdin reconcile 到 central
|
读取 reviewer token,在内存中组成受限 kubeconfig,再通过 stdin reconcile 到 central
|
||||||
集群的 `spire-server/spire-external-kubeconfigs` Secret。凭据不写入仓库、日志或控制机
|
集群的 `spire-server/spire-external-kubeconfigs` Secret。凭据不写入仓库、日志或控制机
|
||||||
|
|||||||
@@ -111,7 +111,8 @@ server manifests 管理;root 使用 homelab CA 访问公开 Gitea 仓库,不
|
|||||||
## SPIRE 跨集群 bootstrap
|
## SPIRE 跨集群 bootstrap
|
||||||
|
|
||||||
Sandbox 复用 homelab 的 SPIRE Server 与 `ddupan.top` trust domain。Flux 首先安装
|
Sandbox 复用 homelab 的 SPIRE Server 与 `ddupan.top` trust domain。Flux 首先安装
|
||||||
SPIRE CRD,并创建权限仅为 `authentication.k8s.io/tokenreviews.create` 的 reviewer。
|
SPIRE CRD,并创建供 k8s_psat 使用的 reviewer。它按上游 Server chart 的权限模型调用
|
||||||
|
TokenReview,并以 `get/list` 读取用于证明的 Pod 与 Node;不具有修改 workload 的权限。
|
||||||
在该 Kustomization Ready 后运行:
|
在该 Kustomization Ready 后运行:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -124,7 +125,8 @@ Playbook 不把 reviewer token 或生成的 kubeconfig 落盘,而是将目标
|
|||||||
`spire-server/spire-external-kubeconfigs` 由 Ansible 单独拥有;Flux 和人工操作不得写入。
|
`spire-server/spire-external-kubeconfigs` 由 Ansible 单独拥有;Flux 和人工操作不得写入。
|
||||||
第二次运行必须为零变更。
|
第二次运行必须为零变更。
|
||||||
|
|
||||||
Secret 的 `sandbox` key 仅供 SPIRE Server 的 external PSAT plugin 执行 TokenReview;
|
Secret 的 `sandbox` key 仅供 SPIRE Server 的 external PSAT plugin 验证 token 与对应的
|
||||||
|
Pod/Node;
|
||||||
`sandbox-controller` key 供 external controller-manager 读取 Pod/Node、reconcile SPIFFE
|
`sandbox-controller` key 供 external controller-manager 读取 Pod/Node、reconcile SPIFFE
|
||||||
CR 及执行 leader election。两者使用不同 ServiceAccount,不得合并权限或互换。
|
CR 及执行 leader election。两者使用不同 ServiceAccount,不得合并权限或互换。
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,18 @@ rules:
|
|||||||
resources:
|
resources:
|
||||||
- tokenreviews
|
- tokenreviews
|
||||||
verbs:
|
verbs:
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- watch
|
||||||
- create
|
- create
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
resources:
|
||||||
|
- nodes
|
||||||
|
- pods
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- list
|
||||||
---
|
---
|
||||||
apiVersion: rbac.authorization.k8s.io/v1
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
kind: ClusterRoleBinding
|
kind: ClusterRoleBinding
|
||||||
|
|||||||
Reference in New Issue
Block a user