Skip to content

Commit 85f346d

Browse files
committed
Single file for creating an RBAC service mesh
Signed-off-by: Nathan Fisher <nfisher@junctionbox.ca>
1 parent 9750907 commit 85f346d

File tree

2 files changed

+61
-3
lines changed

2 files changed

+61
-3
lines changed

k8s-daemonset/k8s/linkerd-rbac.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ metadata:
3030
subjects:
3131
- kind: ServiceAccount
3232
name: default
33-
namespace: default
33+
namespace: linkerd
3434
roleRef:
3535
kind: ClusterRole
3636
name: linkerd-endpoints-reader
@@ -43,7 +43,7 @@ metadata:
4343
subjects:
4444
- kind: ServiceAccount
4545
name: default
46-
namespace: default
46+
namespace: linkerd
4747
roleRef:
4848
kind: ClusterRole
4949
name: namerd-dtab-storage

k8s-daemonset/k8s/servicemesh-rbac.yml

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,64 @@
3838
# * Automatic retries
3939
# * Zipkin tracing
4040
################################################################################
41+
---
42+
kind: Namespace
43+
apiVersion: v1
44+
metadata:
45+
name: linkerd
46+
labels:
47+
name: linkerd
48+
# RBAC configs for linkerd
49+
---
50+
# grant linkerd/namerd permissions to enable service discovery
51+
kind: ClusterRole
52+
apiVersion: rbac.authorization.k8s.io/v1beta1
53+
metadata:
54+
name: linkerd-endpoints-reader
55+
rules:
56+
- apiGroups: [""] # "" indicates the core API group
57+
resources: ["endpoints", "services", "pods"] # pod access is required for the *-legacy.yml examples in this folder
58+
verbs: ["get", "watch", "list"]
59+
- apiGroups: [ "extensions" ]
60+
resources: [ "ingresses" ]
61+
verbs: ["get", "watch", "list"]
62+
---
63+
# grant namerd permissions to custom resource definitions in k8s 1.8+ and third party resources in k8s < 1.8 for dtab storage
64+
kind: ClusterRole
65+
apiVersion: rbac.authorization.k8s.io/v1beta1
66+
metadata:
67+
name: namerd-dtab-storage
68+
rules:
69+
- apiGroups: ["l5d.io"]
70+
resources: ["dtabs"]
71+
verbs: ["get", "watch", "list", "update", "create"]
72+
---
73+
kind: ClusterRoleBinding
74+
apiVersion: rbac.authorization.k8s.io/v1beta1
75+
metadata:
76+
name: linkerd-role-binding
77+
subjects:
78+
- kind: ServiceAccount
79+
name: default
80+
namespace: linkerd
81+
roleRef:
82+
kind: ClusterRole
83+
name: linkerd-endpoints-reader
84+
apiGroup: rbac.authorization.k8s.io
85+
---
86+
kind: ClusterRoleBinding
87+
apiVersion: rbac.authorization.k8s.io/v1beta1
88+
metadata:
89+
name: namerd-role-binding
90+
subjects:
91+
- kind: ServiceAccount
92+
name: default
93+
namespace: linkerd
94+
roleRef:
95+
kind: ClusterRole
96+
name: namerd-dtab-storage
97+
apiGroup: rbac.authorization.k8s.io
98+
4199
---
42100
apiVersion: v1
43101
kind: ConfigMap
@@ -285,7 +343,7 @@ spec:
285343
app: l5d
286344
spec:
287345
# hostNetwork: true # Uncomment to use host networking (eg for CNI)
288-
serviceAccountName: linkerd-endpoints-reader
346+
serviceAccountName: default
289347
volumes:
290348
- name: l5d-config
291349
configMap:

0 commit comments

Comments
 (0)