|
|
|
@@ -0,0 +1,214 @@
|
|
|
|
|
---
|
|
|
|
|
# Per-agent kubectl identities for agent pods (REN-412, parent REN-284).
|
|
|
|
|
#
|
|
|
|
|
# Each agent gets its own ServiceAccount instead of the shared pod token of
|
|
|
|
|
# `paperclip-prometheus-read`. Atlas, Iris, Hestia and Argus get exactly what
|
|
|
|
|
# they hold today through that shared account: built-in `view` cluster-wide
|
|
|
|
|
# (no Secrets, no write verb) plus the `monitoring/paperclip-prometheus-read`
|
|
|
|
|
# Role (see prometheus-read-rbac.yaml). Hermes gets only `get` on the five
|
|
|
|
|
# token Secrets below, to issue and rotate the kubeconfigs.
|
|
|
|
|
#
|
|
|
|
|
# Token Secrets carry no data in git; kube-controller-manager fills
|
|
|
|
|
# `data.token`. Flux applies server-side and does not own `data`, so it does
|
|
|
|
|
# not wipe the token. Revoke one agent: delete its Secret (the token dies at
|
|
|
|
|
# once; Flux recreates it with a fresh token on the next reconcile).
|
|
|
|
|
#
|
|
|
|
|
# The shared account may read the tokens too (Hermes still runs in the shared
|
|
|
|
|
# pod). Each token is worth at most what the shared account already holds, so
|
|
|
|
|
# that is no escalation. Drop that subject once Hermes runs in its own pod.
|
|
|
|
|
#
|
|
|
|
|
# PRODUCTION
|
|
|
|
|
#
|
|
|
|
|
# ServiceAccounts, bindings and empty token Secrets only. No workload changes,
|
|
|
|
|
# nothing restarts. Revert: delete this file and its line in kustomization.yaml.
|
|
|
|
|
---
|
|
|
|
|
apiVersion: v1
|
|
|
|
|
kind: ServiceAccount
|
|
|
|
|
metadata:
|
|
|
|
|
name: agent-atlas
|
|
|
|
|
namespace: paperclip
|
|
|
|
|
labels:
|
|
|
|
|
app.kubernetes.io/name: paperclip
|
|
|
|
|
automountServiceAccountToken: false
|
|
|
|
|
---
|
|
|
|
|
apiVersion: v1
|
|
|
|
|
kind: ServiceAccount
|
|
|
|
|
metadata:
|
|
|
|
|
name: agent-iris
|
|
|
|
|
namespace: paperclip
|
|
|
|
|
labels:
|
|
|
|
|
app.kubernetes.io/name: paperclip
|
|
|
|
|
automountServiceAccountToken: false
|
|
|
|
|
---
|
|
|
|
|
apiVersion: v1
|
|
|
|
|
kind: ServiceAccount
|
|
|
|
|
metadata:
|
|
|
|
|
name: agent-hestia
|
|
|
|
|
namespace: paperclip
|
|
|
|
|
labels:
|
|
|
|
|
app.kubernetes.io/name: paperclip
|
|
|
|
|
automountServiceAccountToken: false
|
|
|
|
|
---
|
|
|
|
|
apiVersion: v1
|
|
|
|
|
kind: ServiceAccount
|
|
|
|
|
metadata:
|
|
|
|
|
name: agent-argus
|
|
|
|
|
namespace: paperclip
|
|
|
|
|
labels:
|
|
|
|
|
app.kubernetes.io/name: paperclip
|
|
|
|
|
automountServiceAccountToken: false
|
|
|
|
|
---
|
|
|
|
|
apiVersion: v1
|
|
|
|
|
kind: ServiceAccount
|
|
|
|
|
metadata:
|
|
|
|
|
name: agent-hermes
|
|
|
|
|
namespace: paperclip
|
|
|
|
|
labels:
|
|
|
|
|
app.kubernetes.io/name: paperclip
|
|
|
|
|
automountServiceAccountToken: false
|
|
|
|
|
---
|
|
|
|
|
apiVersion: v1
|
|
|
|
|
kind: Secret
|
|
|
|
|
type: kubernetes.io/service-account-token
|
|
|
|
|
metadata:
|
|
|
|
|
name: agent-atlas-token
|
|
|
|
|
namespace: paperclip
|
|
|
|
|
labels:
|
|
|
|
|
app.kubernetes.io/name: paperclip
|
|
|
|
|
annotations:
|
|
|
|
|
kubernetes.io/service-account.name: agent-atlas
|
|
|
|
|
---
|
|
|
|
|
apiVersion: v1
|
|
|
|
|
kind: Secret
|
|
|
|
|
type: kubernetes.io/service-account-token
|
|
|
|
|
metadata:
|
|
|
|
|
name: agent-iris-token
|
|
|
|
|
namespace: paperclip
|
|
|
|
|
labels:
|
|
|
|
|
app.kubernetes.io/name: paperclip
|
|
|
|
|
annotations:
|
|
|
|
|
kubernetes.io/service-account.name: agent-iris
|
|
|
|
|
---
|
|
|
|
|
apiVersion: v1
|
|
|
|
|
kind: Secret
|
|
|
|
|
type: kubernetes.io/service-account-token
|
|
|
|
|
metadata:
|
|
|
|
|
name: agent-hestia-token
|
|
|
|
|
namespace: paperclip
|
|
|
|
|
labels:
|
|
|
|
|
app.kubernetes.io/name: paperclip
|
|
|
|
|
annotations:
|
|
|
|
|
kubernetes.io/service-account.name: agent-hestia
|
|
|
|
|
---
|
|
|
|
|
apiVersion: v1
|
|
|
|
|
kind: Secret
|
|
|
|
|
type: kubernetes.io/service-account-token
|
|
|
|
|
metadata:
|
|
|
|
|
name: agent-argus-token
|
|
|
|
|
namespace: paperclip
|
|
|
|
|
labels:
|
|
|
|
|
app.kubernetes.io/name: paperclip
|
|
|
|
|
annotations:
|
|
|
|
|
kubernetes.io/service-account.name: agent-argus
|
|
|
|
|
---
|
|
|
|
|
apiVersion: v1
|
|
|
|
|
kind: Secret
|
|
|
|
|
type: kubernetes.io/service-account-token
|
|
|
|
|
metadata:
|
|
|
|
|
name: agent-hermes-token
|
|
|
|
|
namespace: paperclip
|
|
|
|
|
labels:
|
|
|
|
|
app.kubernetes.io/name: paperclip
|
|
|
|
|
annotations:
|
|
|
|
|
kubernetes.io/service-account.name: agent-hermes
|
|
|
|
|
---
|
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
|
kind: ClusterRoleBinding
|
|
|
|
|
metadata:
|
|
|
|
|
name: paperclip-agents-view
|
|
|
|
|
labels:
|
|
|
|
|
app.kubernetes.io/name: paperclip
|
|
|
|
|
roleRef:
|
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
|
|
|
|
kind: ClusterRole
|
|
|
|
|
name: view
|
|
|
|
|
subjects:
|
|
|
|
|
- kind: ServiceAccount
|
|
|
|
|
name: agent-atlas
|
|
|
|
|
namespace: paperclip
|
|
|
|
|
- kind: ServiceAccount
|
|
|
|
|
name: agent-iris
|
|
|
|
|
namespace: paperclip
|
|
|
|
|
- kind: ServiceAccount
|
|
|
|
|
name: agent-hestia
|
|
|
|
|
namespace: paperclip
|
|
|
|
|
- kind: ServiceAccount
|
|
|
|
|
name: agent-argus
|
|
|
|
|
namespace: paperclip
|
|
|
|
|
---
|
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
|
kind: RoleBinding
|
|
|
|
|
metadata:
|
|
|
|
|
name: paperclip-agents-prometheus-read
|
|
|
|
|
namespace: monitoring
|
|
|
|
|
labels:
|
|
|
|
|
app.kubernetes.io/name: paperclip
|
|
|
|
|
roleRef:
|
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
|
|
|
|
kind: Role
|
|
|
|
|
# Existing Role in prometheus-read-rbac.yaml, unchanged.
|
|
|
|
|
name: paperclip-prometheus-read
|
|
|
|
|
# Subjects live in `paperclip`, the binding in `monitoring`: `namespace:` is
|
|
|
|
|
# load-bearing.
|
|
|
|
|
subjects:
|
|
|
|
|
- kind: ServiceAccount
|
|
|
|
|
name: agent-atlas
|
|
|
|
|
namespace: paperclip
|
|
|
|
|
- kind: ServiceAccount
|
|
|
|
|
name: agent-iris
|
|
|
|
|
namespace: paperclip
|
|
|
|
|
- kind: ServiceAccount
|
|
|
|
|
name: agent-hestia
|
|
|
|
|
namespace: paperclip
|
|
|
|
|
- kind: ServiceAccount
|
|
|
|
|
name: agent-argus
|
|
|
|
|
namespace: paperclip
|
|
|
|
|
---
|
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
|
kind: Role
|
|
|
|
|
metadata:
|
|
|
|
|
name: agent-token-read
|
|
|
|
|
namespace: paperclip
|
|
|
|
|
labels:
|
|
|
|
|
app.kubernetes.io/name: paperclip
|
|
|
|
|
rules:
|
|
|
|
|
- apiGroups: [""]
|
|
|
|
|
resources: ["secrets"]
|
|
|
|
|
verbs: ["get"]
|
|
|
|
|
resourceNames:
|
|
|
|
|
- agent-atlas-token
|
|
|
|
|
- agent-iris-token
|
|
|
|
|
- agent-hestia-token
|
|
|
|
|
- agent-argus-token
|
|
|
|
|
- agent-hermes-token
|
|
|
|
|
---
|
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
|
kind: RoleBinding
|
|
|
|
|
metadata:
|
|
|
|
|
name: agent-token-read
|
|
|
|
|
namespace: paperclip
|
|
|
|
|
labels:
|
|
|
|
|
app.kubernetes.io/name: paperclip
|
|
|
|
|
roleRef:
|
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
|
|
|
|
kind: Role
|
|
|
|
|
name: agent-token-read
|
|
|
|
|
subjects:
|
|
|
|
|
# Hermes still runs in the shared pod; drop this subject once Hermes runs in
|
|
|
|
|
# its own pod.
|
|
|
|
|
- kind: ServiceAccount
|
|
|
|
|
name: paperclip-prometheus-read
|
|
|
|
|
namespace: paperclip
|
|
|
|
|
- kind: ServiceAccount
|
|
|
|
|
name: agent-hermes
|
|
|
|
|
namespace: paperclip
|