Created
October 11, 2019 06:43
-
-
Save chanjarster/d5116cad45e8643c2675f541b0aa1939 to your computer and use it in GitHub Desktop.
Initialize Tiller Service Account For Each Namespace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ]; then | |
echo 'usage: init-tiller-sa.sh <namespace>' | |
exit 1 | |
fi | |
namespace=$1 | |
cat <<EOF | kubectl apply -f - | |
kind: ServiceAccount | |
apiVersion: v1 | |
metadata: | |
name: tiller | |
namespace: $namespace | |
EOF | |
cat <<EOF | kubectl apply -f - | |
kind: Role | |
apiVersion: rbac.authorization.k8s.io/v1 | |
metadata: | |
name: tiller-manager | |
namespace: $namespace | |
rules: | |
- apiGroups: ["", "batch", "extensions", "apps"] | |
resources: ["*"] | |
verbs: ["*"] | |
EOF | |
cat <<EOF | kubectl apply -f - | |
kind: RoleBinding | |
apiVersion: rbac.authorization.k8s.io/v1 | |
metadata: | |
name: tiller-binding | |
namespace: $namespace | |
subjects: | |
- kind: ServiceAccount | |
name: tiller | |
namespace: $namespace | |
roleRef: | |
kind: Role | |
name: tiller-manager | |
apiGroup: rbac.authorization.k8s.io | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment