新增learn-kubernetes(https://github.com/yyong-brs/learn-kubernetes)相关文件
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: sre-view-cluster
|
||||
labels:
|
||||
kiamol: ch17
|
||||
subjects:
|
||||
- kind: Group
|
||||
name: sre
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: view
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: sre-edit-ch17
|
||||
namespace: kiamol-ch17
|
||||
subjects:
|
||||
- kind: Group
|
||||
name: sre
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: edit
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
@@ -0,0 +1,25 @@
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: logs-reader
|
||||
labels:
|
||||
kiamol: ch17
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources: ["pods", "pods/log"]
|
||||
verbs: ["get"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: test-logs-cluster
|
||||
labels:
|
||||
kiamol: ch17
|
||||
subjects:
|
||||
- kind: Group
|
||||
name: test
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: logs-reader
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
@@ -0,0 +1,28 @@
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: sre-sa-view-cluster
|
||||
labels:
|
||||
kiamol: ch17
|
||||
subjects:
|
||||
- kind: Group
|
||||
name: system:serviceaccounts:kiamol-authn-sre
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: view
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: sre-sa-edit-ch17
|
||||
namespace: kiamol-ch17
|
||||
subjects:
|
||||
- kind: Group
|
||||
name: system:serviceaccounts:kiamol-authn-sre
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: edit
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
@@ -0,0 +1,14 @@
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: test-sa-logs-cluster
|
||||
labels:
|
||||
kiamol: ch17
|
||||
subjects:
|
||||
- kind: Group
|
||||
name: system:serviceaccounts:kiamol-authn-test
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: logs-reader
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
@@ -0,0 +1,21 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: kiamol-authn-sre
|
||||
labels:
|
||||
kiamol: ch17
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: sre2
|
||||
namespace: kiamol-authn-sre
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: sre2-sa-token
|
||||
namespace: kiamol-authn-sre
|
||||
annotations:
|
||||
kubernetes.io/service-account.name: sre2
|
||||
type: kubernetes.io/service-account-token
|
||||
@@ -0,0 +1,21 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: kiamol-authn-test
|
||||
labels:
|
||||
kiamol: ch17
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: tester2
|
||||
namespace: kiamol-authn-test
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: tester2-sa-token
|
||||
namespace: kiamol-authn-test
|
||||
annotations:
|
||||
kubernetes.io/service-account.name: tester2
|
||||
type: kubernetes.io/service-account-token
|
||||
@@ -0,0 +1,18 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: sre-user
|
||||
labels:
|
||||
kiamol: ch17
|
||||
spec:
|
||||
serviceAccountName: user-cert-generator
|
||||
containers:
|
||||
- name: user-cert-generator
|
||||
image: kiamol/ch17-user-cert-generator
|
||||
env:
|
||||
- name: USER_NAME
|
||||
value: sre1
|
||||
- name: GROUP
|
||||
value: sre
|
||||
- name: SET_CONTEXT
|
||||
value: "true"
|
||||
@@ -0,0 +1,18 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: test-user
|
||||
labels:
|
||||
kiamol: ch17
|
||||
spec:
|
||||
serviceAccountName: user-cert-generator
|
||||
containers:
|
||||
- name: user-cert-generator
|
||||
image: kiamol/ch17-user-cert-generator
|
||||
env:
|
||||
- name: USER_NAME
|
||||
value: tester1
|
||||
- name: GROUP
|
||||
value: test
|
||||
- name: SET_CONTEXT
|
||||
value: "true"
|
||||
Reference in New Issue
Block a user