Skip to content

Instantly share code, notes, and snippets.

@pandeybk
Last active November 4, 2017 00:24
Show Gist options
  • Save pandeybk/4dd19bad7756aed46cea4f9b9004f4dc to your computer and use it in GitHub Desktop.
Save pandeybk/4dd19bad7756aed46cea4f9b9004f4dc to your computer and use it in GitHub Desktop.
RBAC Kubernetes Using Service Account
apiVersion: v1
kind: Namespace
metadata:
name: goglides
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: microservice
name: goglidescustomsa
namespace: goglides
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: goglidedeployerrole
namespace: goglides
rules:
- apiGroups: ["apps"]
resources: ["deployments"]
verbs: ["get", "list", "watch", "create", "delete", "update", "patch"]
- apiGroups: [""] # "" indicates the core API group
resources: ["configmaps", "secrets"]
verbs: ["get", "list", "watch", "create", "delete", "update", "patch"]
- apiGroups: [""] # "" indicates the core API group
resources: ["pods"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: goglidedeployerrole
namespace: goglides
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: goglidedeployerrole
subjects:
- kind: ServiceAccount
name: goglidescustomsa
namespace: goglides
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment