首页 > 其他分享 >rbac cka

rbac cka

时间:2023-06-11 21:14:00浏览次数:39  
标签:cka cicd create clusterrole rbac k8s app

题目:

 

Create a new ClusterRole named deployment-clusterrole which only allows to create the following resource types.
Deployment
StatefulSet
DaemonSet


Create a new ServiceAccount named cicd-token in the existing namespace app-team1 .

Bind the new ClusterRole deployment-cluster role to the new ServiceAccount cicd-token , limited to the namespace app-team1

参考: https://kubernetes.io/zh/docs/reference/access-authn-authz/rbac/

 

root@k8s-master:~# cat clusterrole-demo.yml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
# "namespace" 被忽略,因为 ClusterRoles 不受名字空间限制
name: deployment-clusterrole
rules:
- apiGroups: [""]
# 在 HTTP 层面,用来访问 Secret 资源的名称为 "secrets"
resources: ["deployments","statefullsets","daemonsets"]
verbs: ["create"]


root@k8s-master:~# kubectl create -f clusterrole-demo.yml
clusterrole.rbac.authorization.k8s.io/deployment-clusterrole created
root@k8s-master:~# kubectl create ns app-team1
namespace/app-team1 created
root@k8s-master:~# kubectl create sa cicd-token
serviceaccount/cicd-token created

root@k8s-master:~# kubectl create clusterrolebinding role-admin --clusterrole=deployment-clusterrole --serviceaccount=app-team1:cicd-token -n app-team1
clusterrolebinding.rbac.authorization.k8s.io/role-admin created

标签:cka,cicd,create,clusterrole,rbac,k8s,app
From: https://www.cnblogs.com/xiangyu5945/p/17473604.html

相关文章

  • k8s 升级 cka
    题目:GivenanexistingKubernetesclusterrunningversion1.18.8upgradealloftheKubernetescontrolplaneandnodeComponentsonthemasternodeonlytoversion1.19.0.Youarealsoexpectedtoupgradekubeletandkubectlonthemasternode.Besuretod......
  • 系统权限ABAC和RBAC
    ABAC的思想是基于用户、以及将要访问的数据的属性、以及各种环境因素去动态计算用户是否有权限进行操作。转载:https://juejin.cn/post/6941734947551969288#commenthttps://blog.csdn.net/hhhhhhhhhhhhhhhc/article/details/125906529......
  • nodejs package.json
    package.json是用来识别项目并且处理项目的依赖关系的{"name":"名",//包名字"version":"1.0.0",//版本"description":"描述","main":"index.js",//入口文件"scripts":{//指定运行脚本......
  • ExcelPackage操作Excel的常用方法
    游戏开发中最常用的工具应该当属Excel了,而Excel在数据量比较大,或者多张表进行关联的时候操作比较繁琐,偶尔会有一些工具需要,减化上述的一些操作,提升工作效率。最开始想使用Node.js,发现二个问题,Github上第三方库,在保存Excel的时候会将格式给丢掉。找来找来,发现C#的Epplus比较......
  • Nutika 打包 docx 库 出现 docx.opc.exceptions.PackageNotFoundError: Package not f
    docx.opc.exceptions.PackageNotFoundError:Packagenotfoundat重现用以下命令打包exe:nuitka--standalone--show-memory--show-progress--nofollow-imports--enable-plugin=pyqt5--follow-import-to=utils,src--output-dir=out--windows-icon-from-ico=./termius_1.......
  • 【VMware】CentOS6.5 Loaded plugins: fastestmirror, refresh-packagekit, security
    最近在用Centos6.5的时候出现了这种情况,[root@bogonDesktop]#yum-yinstalldockerLoadedplugins:fastestmirror,refresh-packagekit,securityLoadingmirrorspeedsfromcachedhostfile *base:mirrors.aliyun.com *extras:mirrors.nwsuaf.edu.cn *updates:m......
  • git add 时报错 warning: in the working copy of 'package-lock.json', LF will...
    来源:https://blog.csdn.net/qq_43842093/article/details/128471953问题:执行gitadd.时报错: 原因:换行符的问题, Windows下换行符和Unix下的换行符不一样,git会自动转换。 解决办法: 执行如下命令:gitconfig--globalcore.autocrlffalse问题解决 ......
  • 安装k8s 时报错No package kubelet-1.20.9 available.
    报错信息:[root@vm~]#sudoyuminstall-ykubelet-1.20.9kubeadm-1.20.9kubectl-1.20.9--disableexcludes=kubernetesLoadedplugins:fastestmirrorLoadingmirrorspeedsfromcachedhostfileepel:mirror-icn.yuki.net.ukNopackagekubelet-1.20.9available.No......
  • protobuf 中go_package的意思
    一个简单的protobuf文件定义如下:response.protosyntax="proto3";optiongo_package="github.com/TripleCGame/apis/api;api";import"google/protobuf/struct.proto";messageResponse{int32code=1;google.protobuf.Structdata......
  • RBAC模型
    RBAC权限管理RBAC是将用户和角色直接关联而不是像以前那样将用户和权限直接关联中间多了个角色这样一个分组。RBAC权限模型:用户--->角色--->权限比如:用户:张三李四...角色:销售查看商品列表查看订单财务查看财务...权限:添加XXX删除XXX首页菜单.......