Last active
April 9, 2024 02:10
-
-
Save azlkiniue/22f1e4a9d579ed1c68e7f6b566f99a1b to your computer and use it in GitHub Desktop.
Create Read-only Kubernetes Config
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
apiVersion: v1 | |
kind: ServiceAccount | |
metadata: | |
name: read-only-user | |
secrets: | |
- name: read-only-secret | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1 | |
kind: ClusterRole | |
metadata: | |
name: read-only-role | |
rules: | |
- apiGroups: [""] | |
resources: ["*"] | |
verbs: ["get", "list", "watch"] | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1 | |
kind: ClusterRoleBinding | |
metadata: | |
name: read-only-role-binding | |
subjects: | |
- kind: ServiceAccount | |
name: read-only-user | |
namespace: default # Replace with the namespace where you want to grant read-only access. | |
roleRef: | |
kind: ClusterRole | |
name: read-only-role | |
apiGroup: rbac.authorization.k8s.io | |
--- | |
apiVersion: v1 | |
kind: Secret | |
metadata: | |
name: read-only-secret | |
annotations: | |
kubernetes.io/service-account.name: read-only-user | |
type: kubernetes.io/service-account-token |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment