@@ -99,30 +99,16 @@ Alternatively, these could also be fetched from Kubernetes secrets or even
99
99
This guide assumes you have a `coder-workspaces` namespace on your remote
100
100
cluster. Change the namespace accordingly.
101
101
102
- # ## Create a ServiceAccount
102
+ # ## Create a Role and RoleBinding
103
103
104
- Run this command against your remote cluster to create a ServiceAccount, Role,
105
- RoleBinding, and token :
104
+ Run this command against your remote cluster to create a Role and RoleBinding :
106
105
107
106
` ` ` shell
108
107
kubectl apply -n coder-workspaces -f - <<EOF
109
- apiVersion: v1
110
- kind: ServiceAccount
111
- metadata:
112
- name: coder-v2
113
- ---
114
- apiVersion: v1
115
- kind: Secret
116
- metadata:
117
- name: coder-v2
118
- annotations:
119
- kubernetes.io/service-account.name: coder-v2
120
- type: kubernetes.io/service-account-token
121
- ---
122
108
apiVersion: rbac.authorization.k8s.io/v1
123
109
kind: Role
124
110
metadata:
125
- name: coder-v2
111
+ name: coder-workspaces
126
112
rules:
127
113
- apiGroups: ["", "apps", "networking.k8s.io"]
128
114
resources: ["persistentvolumeclaims", "pods", "deployments", "services", "secrets", "pods/exec","pods/log", "events", "networkpolicies", "serviceaccounts"]
@@ -134,24 +120,22 @@ rules:
134
120
apiVersion: rbac.authorization.k8s.io/v1
135
121
kind: RoleBinding
136
122
metadata:
137
- name: coder-v2
123
+ name: coder-workspaces
138
124
subjects:
139
125
- kind: ServiceAccount
140
- name: coder-v2
126
+ name: coder
141
127
roleRef:
142
128
kind: Role
143
- name: coder-v2
129
+ name: coder-workspaces
144
130
apiGroup: rbac.authorization.k8s.io
145
131
EOF
146
132
` ` `
147
133
148
134
The output should be similar to :
149
135
150
136
` ` ` text
151
- serviceaccount/coder-v2 created
152
- secret/coder-v2 created
153
- role.rbac.authorization.k8s.io/coder-v2 created
154
- rolebinding.rbac.authorization.k8s.io/coder-v2 created
137
+ role.rbac.authorization.k8s.io/coder-workspaces created
138
+ rolebinding.rbac.authorization.k8s.io/coder-workspaces created
155
139
` ` `
156
140
157
141
# ## 2. Modify the Kubernetes template
0 commit comments