我想直接通过yaml创建ServiceAccount,ClusterRole,ClusterRoleBinding,请问可以吗?
在哪里创建,类似下方yaml
#创建账号
apiVersion: v1
kind: ServiceAccount
metadata:
namespace: demo-namespace # 修改点1命名空间
name: demo-account # 修改点2账户名称
---
#创建角色对应操作
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: goZero #修改点3角色名称
rules:
- apiGroups: [""]
resources: [“endpoints”]
verbs: [“get”,“list”,“watch”]
---
#给账号绑定角色
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: demo-goZero #修改点4绑定关系名称
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: goZero #修改点5角色名称
subjects:
- kind: ServiceAccount
name: demo-account #修改点6账户名称
namespace: demo-namespace #修改点7账户名称对应的命名空间
直接通过yaml创建资源
5 天 后
hongzhouziK零S
1、可以登陆到集群环境,通过 kubectl 命令行创建
2、kubesphere 页面上可以 admin 登录后点右下角点小锤子,通过 kubectl 命令行工具创建