kubernetes-yaml/learn/learn-kubernetes-master/kiamol/ch17/user-cert-generator.yaml

52 lines
1.2 KiB
YAML
Raw Normal View History

apiVersion: v1
kind: ServiceAccount
metadata:
name: user-cert-generator
labels:
kiamol: ch17
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: create-approve-csr
labels:
kiamol: ch17
rules:
- apiGroups: ["certificates.k8s.io"]
resources: ["certificatesigningrequests"]
verbs: ["create", "get", "list", "watch", "patch"]
- apiGroups: ["certificates.k8s.io"]
resources: ["certificatesigningrequests/approval"]
verbs: ["update"]
- apiGroups: ["certificates.k8s.io"]
resources: ["signers"]
resourceNames: ["kubernetes.io/kube-apiserver-client", "kubernetes.io/legacy-unknown"]
verbs: ["approve"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: user-cert-generator
labels:
kiamol: ch17
subjects:
- kind: ServiceAccount
name: user-cert-generator
namespace: default
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: create-approve-csr
---
apiVersion: v1
kind: Pod
metadata:
name: user-cert-generator
labels:
kiamol: ch17
spec:
serviceAccountName: user-cert-generator
containers:
- name: user-cert-generator
image: kiamol/ch17-user-cert-generator