AKS集成RBAC与AAD

3种模式:

  • K8s自己的rbac
  • Azure上的RBAC
  • Azure上的rbac K8s的RBAC与AAD的集成

VSCode实现:
需要:Azure CLI+Rolebinding.yaml+Role.yaml:
注意terminal要切换到Azure cloud shell下。
rbac-aks-aad.azcli:

az aks get-credentials --resource-group Daisyaks --name Daisyaks --admin

kubectl apply -f role.yaml

kubectl get roles

kubectl apply -f role-binding.yaml

kubectl get rolebindings

kubectl get nodes

kubectl get pods

在现有的集群上启用AKS托管的Azure AD集成

az aks update -g Daisyaks -n Daisyaks --enable-aad --aad-admin-group-object-ids 42de7d80-3209-494d-9c7f-1f15c86b8829 --aad-tenant-id 4f165557-1ad2-4f81-953c-cbc3ca9781ed

Rolebinding.yaml:

kind: RoleBinding

apiVersion: rbac.authorization.k8s.io/v1

metadata:

    name: read-pods

    namespace: default #optional

subjects:

  - kind: User

    name: "5a2f5744-e520-4d9d-a70e-c281441bd468"

    apiGroup: rbac.authorization.k8s.io/v1

roleRef:

  apiGroup: Role

  kind: pod-reader

  name: rbac.authorization.k8s.io/v1

Role.yaml:

kind: Role

apiVersion: rbac.authorization.k8s.io/v1

metadata:

    name: read-pods

    namespace: default #optional

rules:

- apiGroups: [""] #the core api group

  resources: ["pods"]

  verbs: ["get", "watch", "list"]

在这里插入图片描述

结果展示:

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值