Skip to content

Commit 68704f3

Browse files
committed
create cluster admin for token
1 parent 2e2d3e6 commit 68704f3

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

scripts/2_setup_kubernetes.sh

+19
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,25 @@ function setup_kubectl {
3333
cp -i /etc/kubernetes/admin.conf /root/.kube/config
3434

3535
aws s3 cp /etc/kubernetes/admin.conf s3://$(cat /etc/terraform/s3_bucket) --region eu-central-1
36+
37+
kubectl create serviceaccount cluster-admin -n kube-system
38+
cat <<EOF >/tmp/cluster-admin.yaml
39+
apiVersion: rbac.authorization.k8s.io/v1beta1
40+
kind: ClusterRoleBinding
41+
metadata:
42+
name: cluster-admin
43+
labels:
44+
k8s-app: cluster-admin
45+
roleRef:
46+
apiGroup: rbac.authorization.k8s.io
47+
kind: ClusterRole
48+
name: cluster-admin
49+
subjects:
50+
- kind: ServiceAccount
51+
name: cluster-admin
52+
namespace: kube-system
53+
EOF
54+
su ubuntu -c "kubectl apply -f /tmp/cluster-admin.yaml" -n kube-system
3655
}
3756

3857
function setup_network {

0 commit comments

Comments
 (0)