Created
August 13, 2018 15:22
-
-
Save Dviejopomata/df32d046b838cce2dff02ca27e98d894 to your computer and use it in GitHub Desktop.
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
cat <<EOF | kubectl create -f - | |
apiVersion: rbac.authorization.k8s.io/v1beta1 | |
kind: ClusterRoleBinding | |
metadata: | |
name: kubernetes-dashboard | |
labels: | |
k8s-app: kubernetes-dashboard | |
roleRef: | |
apiGroup: rbac.authorization.k8s.io | |
kind: ClusterRole | |
name: cluster-admin | |
subjects: | |
- kind: ServiceAccount | |
name: kubernetes-dashboard | |
namespace: kube-system | |
EOF | |
cat <<EOF | kubectl create -f - | |
# Wide open access to the cluster (mostly for kubelet) | |
kind: ClusterRole | |
apiVersion: rbac.authorization.k8s.io/v1beta1 | |
metadata: | |
name: cluster-writer | |
rules: | |
- apiGroups: ["*"] | |
resources: ["*"] | |
verbs: ["*"] | |
- nonResourceURLs: ["*"] | |
verbs: ["*"] | |
--- | |
# Full read access to the api and resources | |
kind: ClusterRole | |
apiVersion: rbac.authorization.k8s.io/v1beta1 | |
metadata: | |
name: cluster-reader | |
rules: | |
- apiGroups: ["*"] | |
resources: ["*"] | |
verbs: ["get", "list", "watch"] | |
- nonResourceURLs: ["*"] | |
verbs: ["*"] | |
--- | |
# Give admin, kubelet, kube-system, kube-proxy god access | |
kind: ClusterRoleBinding | |
apiVersion: rbac.authorization.k8s.io/v1beta1 | |
metadata: | |
name: cluster-write | |
subjects: | |
- kind: User | |
name: admin | |
- kind: User | |
name: kubelet | |
- kind: ServiceAccount | |
name: default | |
namespace: kube-system | |
- kind: User | |
name: kube-proxy | |
roleRef: | |
kind: ClusterRole | |
name: cluster-writer | |
apiGroup: rbac.authorization.k8s.io | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment