-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrbac.yaml
More file actions
66 lines (62 loc) · 2.04 KB
/
Copy pathrbac.yaml
File metadata and controls
66 lines (62 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Minimal permissions for Marsad.
#
# Every verb here is a read. Marsad has no write path in its code — not a
# disabled one, an absent one — and this ClusterRole is the second half of that
# guarantee: even a compromised Marsad cannot change anything through the API.
#
# It is cluster-scoped because network policy is only meaningful across
# namespaces: a peer in one namespace is selected by a policy in another, and a
# namespaceSelector matches labels on Namespace objects themselves.
apiVersion: v1
kind: ServiceAccount
metadata:
name: marsad
namespace: marsad
labels:
app.kubernetes.io/name: marsad
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: marsad
labels:
app.kubernetes.io/name: marsad
rules:
# Namespaces carry the labels a namespaceSelector matches. Pods are needed to
# find workloads no controller owns, and to count live replicas.
- apiGroups: [""]
resources: [namespaces, pods, services]
verbs: [get, list, watch]
# Controllers supply the pod template labels that policies actually select on.
# ReplicaSets are read only to walk Pod → ReplicaSet → Deployment; they never
# appear in the graph.
- apiGroups: [apps]
resources: [deployments, statefulsets, daemonsets, replicasets]
verbs: [get, list, watch]
- apiGroups: [batch]
resources: [jobs, cronjobs]
verbs: [get, list, watch]
- apiGroups: [networking.k8s.io]
resources: [networkpolicies]
verbs: [get, list, watch]
# AWS VPC CNI domain-based egress. Absent outside EKS; Marsad detects that
# through the discovery API and degrades cleanly, so this rule is harmless on
# clusters without the CRD.
- apiGroups: [networking.k8s.aws]
resources: [applicationnetworkpolicies]
verbs: [get, list, watch]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: marsad
labels:
app.kubernetes.io/name: marsad
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: marsad
subjects:
- kind: ServiceAccount
name: marsad
namespace: marsad