Read Only Kubeconfig
Guide to set up a new Service Account with Read only access to a K8s cluster
Supported kubeconfig authentication methods
Creating a read-only kubeconfig access file
Creating the role and service account
---
kind: Namespace
apiVersion: v1
metadata:
name: hava
labels:
name: hava
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: hava-reader
namespace: hava
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
annotations:
rbac.authorization.kubernetes.io/autoupdate: "true"
labels:
name: hava-read-only
namespace: hava
rules:
- apiGroups:
- ""
resources: ["*"]
verbs:
- get
- list
- watch
- apiGroups:
- extensions
resources: ["*"]
verbs:
- get
- list
- watch
- apiGroups:
- apps
resources: ["*"]
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: hava-reader-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: hava-read-only
subjects:
- kind: ServiceAccount
name: hava-reader
namespace: havaUse the service account details to create your kubeconfig

Last updated
Was this helpful?
