@@ -109,22 +109,24 @@ kubectl apply -n coder-workspaces -f - <<EOF
109
109
apiVersion: v1
110
110
kind: ServiceAccount
111
111
metadata:
112
- name: coder-v2
112
+ # Must be different than the Coder control plane service account, so prevent duplicates.
113
+ name: coder-2
113
114
---
114
115
apiVersion: v1
115
116
kind: Secret
116
117
metadata:
117
- name: coder-v2
118
+ name: coder-service-account-token
118
119
annotations:
119
- kubernetes.io/service-account.name: coder-v2
120
+ kubernetes.io/service-account.name: coder
120
121
type: kubernetes.io/service-account-token
121
122
---
122
123
apiVersion: rbac.authorization.k8s.io/v1
123
124
kind: Role
124
125
metadata:
125
- name: coder-v2
126
+ # Must be different than the Coder control plane service account, so prevent duplicates.
127
+ name: coder-2
126
128
rules:
127
- - apiGroups: ["", "apps", "networking.k8s.io"]
129
+ - apiGroups: ["", "apps", "networking.k8s.io"] # "" indicates the core API group
128
130
resources: ["persistentvolumeclaims", "pods", "deployments", "services", "secrets", "pods/exec","pods/log", "events", "networkpolicies", "serviceaccounts"]
129
131
verbs: ["create", "get", "list", "watch", "update", "patch", "delete", "deletecollection"]
130
132
- apiGroups: ["metrics.k8s.io", "storage.k8s.io"]
@@ -134,24 +136,25 @@ rules:
134
136
apiVersion: rbac.authorization.k8s.io/v1
135
137
kind: RoleBinding
136
138
metadata:
137
- name: coder-v2
139
+ # Must be different than the Coder control plane service account, so prevent duplicates.
140
+ name: coder-2
138
141
subjects:
139
142
- kind: ServiceAccount
140
- name: coder-v2
143
+ name: coder
141
144
roleRef:
142
145
kind: Role
143
- name: coder-v2
146
+ name: coder
144
147
apiGroup: rbac.authorization.k8s.io
145
148
EOF
146
149
` ` `
147
150
148
151
The output should be similar to :
149
152
150
153
` ` ` 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
154
+ serviceaccount/coder created
155
+ secret/coder-service-account-token created
156
+ role.rbac.authorization.k8s.io/coder created
157
+ rolebinding.rbac.authorization.k8s.io/coder created
155
158
` ` `
156
159
157
160
# ## 2. Modify the Kubernetes template
@@ -203,9 +206,9 @@ export CLUSTER_ADDRESS=https://example.domain:6443
203
206
To fetch the CA certificate and token :
204
207
205
208
` ` ` shell
206
- export CLUSTER_CA_CERTIFICATE=$(kubectl get secrets coder-v2 -n coder-workspaces -o jsonpath="{.data.ca\. crt}")
209
+ export CLUSTER_CA_CERTIFICATE=$(kubectl get secrets coder-service-account-token -n coder-workspaces -o jsonpath="{.data.ca\. crt}")
207
210
208
- export CLUSTER_SERVICEACCOUNT_TOKEN=$(kubectl get secrets coder-v2 -n coder-workspaces -o jsonpath="{.data.token}")
211
+ export CLUSTER_SERVICEACCOUNT_TOKEN=$(kubectl get secrets coder-service-account-token -n coder-workspaces -o jsonpath="{.data.token}")
209
212
` ` `
210
213
211
214
Create the template with these values :
0 commit comments