安全播报

防御吧作为15年知名老牌域名服务商,CNNIC和CANN双认证域名注册商,已经
持续为500多万个域名提供服务,包括智能DNS/自由转移/隐私保护等服务!
k8s中各组件和kube apiserver通信时的认证和鉴权
2022-06-13 14:15:35 【

和master节点kube api-server通信的组件有很多,包括:

  • kubelet

  • calico

  • scheduler

  • kubectl

  • 某些pod可能会和kube api-server通信

这些组件和api-server通信时用的是什么身份,可以操作哪些api资源呢?

本文使用的k8s集群是用kubekey搭建,命令是./kk create cluster —with-kubernetes v1.21.5 —with-kubesphere v3.2.1

kubectl的身份和权限

kubectl用的是什么身份?

kubectl默认会用到.kube/config配置,其中包含证书信息

  root@ip-172-31-14-204:~# cat .kube/configapiVersion: v1  ...  users:  - name: kubernetes-admin    user:      client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURJVENDQWdtZ0F3SUJBZ0lJSm9rTE5qWVk0UG93RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TWpBMU1qVXdNRE13TURWYUZ3MHlNekExTWpVd01ETXdNRFphTURReApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sa3dGd1lEVlFRREV4QnJkV0psY201bGRHVnpMV0ZrCmJXbHVNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQTI5L25vcEVJWE9JVXl0MngKRUFETUNod01idkhaWU90c2xYdFBsYnNYRXJPOXpmYzBIMi9UV2p2dUFHUDRwaVhPaG5sSnYvRmtKTVVCbk1HWgpmV3VrdU1vTStOSDZkMERFVjlsMUNYUk9BOEhlRStacXBtYmVvbTV3SWdsYlZIeXFzdTZNb2VySTZkYnFqcEdSCmpJUzVyb0tNQU94OFNYRlJxUFZaaEtIdkhFUTk2REt1UWNmMU84ZzlWKzVjYzQwZ295UzBsOHAxOWtBdU1JeTAKQktPWGZxTTMyRkNSSWZKOWJTSzZPQTBDek8wbWlJK0pidVhMMWFzNkE5M08xdWZCdUxOdURTTmZSR015WjJoQgpTdGU3eEZyOFZQRlFsRmJBUklBRnJjK0RvMXBUUk1xZ09kUS8xZVE0bk5iNXRRa0hnZG9raERVZ2owd2hHTmV6Clc0RFlrUUlEQVFBQm8xWXdWREFPQmdOVkhROEJBZjhFQkFNQ0JhQXdFd1lEVlIwbEJBd3dDZ1lJS3dZQkJRVUgKQXdJd0RBWURWUjBUQVFIL0JBSXdBREFmQmdOVkhTTUVHREFXZ0JUZnZPL1VlcDhWbnVmS3Q5QVpOY0tFV05vbApWakFOQmdrcWhraUc5dzBCQVFzRkFBT0NBUUVBdGQ5Q1RwajdEdUw2NDIxanhhMlYrcEhCV2tqRVhqaXdMQUdxCmI4UVpPT2llT2xUcjNPTVVXWWw1NEJpd3N2WmkxYi9pRDlMalhjUnhxR0d1ZytMUS9zNnVRVjBwSWhpL2U1MloKclB6Vm83V2VmSURZQm44RWhwSmsvbjdXYjhyRDJLUmNqNnRNanNFS3ViVkNSRXQyeWdYeFhvSnJ6a21xTkgvSwpGMFdqOGtFV2ZKVENQZnNmV1laNDBKMDJhbGZ4d05QQ080K1BoRDhoSm9xK1h6aitCNWl0TDVNZ2o0ZWFOZHpsCkxnUk4zc3hMZ0QvOVA4MW1NdTBnVDZ1V3d6c0U4VXZGdE9kOXkzOG50Q25HVUF5U2pTU1NOY0thRVVhWTd5KzIKTGxZeXFBZmJGN29pdEJsOWxSSnZmL2thR2trdGJoQ0dnNVk3eVMxSUVWNFVJdTZFb3c9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==  ...

可以看到这个证书的CN是kubernetes-admin,O是system:masters。根据文档可以知道,这表示证书代表的用户是kubernetes-admin,用户组是system:masters。

  root@ip-172-31-14-204:~# echo LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURJVENDQWdtZ0F3SUJBZ0lJSm9rTE5qWVk0UG93RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TWpBMU1qVXdNRE13TURWYUZ3MHlNekExTWpVd01ETXdNRFphTURReApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sa3dGd1lEVlFRREV4QnJkV0psY201bGRHVnpMV0ZrCmJXbHVNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQTI5L25vcEVJWE9JVXl0MngKRUFETUNod01idkhaWU90c2xYdFBsYnNYRXJPOXpmYzBIMi9UV2p2dUFHUDRwaVhPaG5sSnYvRmtKTVVCbk1HWgpmV3VrdU1vTStOSDZkMERFVjlsMUNYUk9BOEhlRStacXBtYmVvbTV3SWdsYlZIeXFzdTZNb2VySTZkYnFqcEdSCmpJUzVyb0tNQU94OFNYRlJxUFZaaEtIdkhFUTk2REt1UWNmMU84ZzlWKzVjYzQwZ295UzBsOHAxOWtBdU1JeTAKQktPWGZxTTMyRkNSSWZKOWJTSzZPQTBDek8wbWlJK0pidVhMMWFzNkE5M08xdWZCdUxOdURTTmZSR015WjJoQgpTdGU3eEZyOFZQRlFsRmJBUklBRnJjK0RvMXBUUk1xZ09kUS8xZVE0bk5iNXRRa0hnZG9raERVZ2owd2hHTmV6Clc0RFlrUUlEQVFBQm8xWXdWREFPQmdOVkhROEJBZjhFQkFNQ0JhQXdFd1lEVlIwbEJBd3dDZ1lJS3dZQkJRVUgKQXdJd0RBWURWUjBUQVFIL0JBSXdBREFmQmdOVkhTTUVHREFXZ0JUZnZPL1VlcDhWbnVmS3Q5QVpOY0tFV05vbApWakFOQmdrcWhraUc5dzBCQVFzRkFBT0NBUUVBdGQ5Q1RwajdEdUw2NDIxanhhMlYrcEhCV2tqRVhqaXdMQUdxCmI4UVpPT2llT2xUcjNPTVVXWWw1NEJpd3N2WmkxYi9pRDlMalhjUnhxR0d1ZytMUS9zNnVRVjBwSWhpL2U1MloKclB6Vm83V2VmSURZQm44RWhwSmsvbjdXYjhyRDJLUmNqNnRNanNFS3ViVkNSRXQyeWdYeFhvSnJ6a21xTkgvSwpGMFdqOGtFV2ZKVENQZnNmV1laNDBKMDJhbGZ4d05QQ080K1BoRDhoSm9xK1h6aitCNWl0TDVNZ2o0ZWFOZHpsCkxnUk4zc3hMZ0QvOVA4MW1NdTBnVDZ1V3d6c0U4VXZGdE9kOXkzOG50Q25HVUF5U2pTU1NOY0thRVVhWTd5KzIKTGxZeXFBZmJGN29pdEJsOWxSSnZmL2thR2trdGJoQ0dnNVk3eVMxSUVWNFVJdTZFb3c9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg== | base64 -d | openssl x509  -noout -text  Certificate:      ...          Subject: O = system:masters, CN = kubernetes-admin

那这个证书代表的用户能操作哪些资源呢?

能操作哪些资源呢?

这个需要看”用户kubernetes-admin”、”用户组system:masters”在集群中绑定了什么”角色”。

可以看到它绑定了”ClusterRole/cluster-admin”,这个角色可以对所有资源做任意操作。

  root@ip-172-31-14-204:~# kubectl get ClusterRoleBinding -A -o wide | grep system:masters  cluster-admin                                          ClusterRole/cluster-admin                                                          33h                                    system:masters

可以通过kubectl get ClusterRole/cluster-admin -o yaml查看角色的权限。

所以,.kube/config证书中代表的用户身份可以对所有资源做任意操作。

kube-scheduler的身份和权限

kube-scheduler用的是什么身份?

在master节点上查看scheduler进程,可以”大胆猜测”用的是/etc/kubernetes/scheduler.conf中的证书信息。

在我的k8s环境中,kube-scheduler是运行在pod中的,不过pod和宿主机的/etc/kubernetes/scheduler.conf文件是一样的

  root@ip-172-31-14-33:~# ps aux|grep kube-scheduler  root     51897  0.2  0.7 753012 57736 ?        Ssl  May25   3:59 kube-scheduler --authentication-kubeconfig=/etc/kubernetes/scheduler.conf --authorization-kubeconfig=/etc/kubernetes/scheduler.conf --bind-address=0.0.0.0 --feature-gates=RotateKubeletServerCertificate=true,TTLAfterFinished=true,ExpandCSIVolumes=true,CSIStorageCapacity=true --kubeconfig=/etc/kubernetes/scheduler.conf --leader-elect=true --port=0

查看证书的Subject信息,可以看到用户是system:kube-scheduler

  root@ip-172-31-14-33:~# echo LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUREVENDQWZXZ0F3SUJBZ0lJUWdERWp2Q3pZdGd3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TWpBMU1qVXdNRE13TURWYUZ3MHlNekExTWpVd01ETXdNRFphTUNBeApIakFjQmdOVkJBTVRGWE41YzNSbGJUcHJkV0psTFhOamFHVmtkV3hsY2pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCCkJRQURnZ0VQQURDQ0FRb0NnZ0VCQUx3blRITU9scnMzMThjRVdoMkZFOUlmMDN1SXBTRmUxUU9jeFhXOFFmb1IKcUp6bS96ZWpwSUxNci82bXRERnp1WFhDWnhVNjA3eWN2VkprKzFCRzJLQjFtTEZDa0JlWlJVQTBjMk5udEhtVQpmVWkwNjhqeHdCeWFEbXlha2N0NENoT0I3K0xGT3I5WHozQ0owcUxaTXp0YnAxUk5nTWR4aE9IQmZZRFlXdWZ1Ckk3b3R0THdlQlZ0R3RNQlNjb1pOZ1lyWEFyb0MyVzBSYkVNUVhYV0pVMjFXUEdyRkxFQjVpZWo5SjRKWUxuRGQKdDcxK0NoWWQxcXA0bVJmZHhIcXB6dG8vSzdEWWo0UzJVS1BleGUxN2QwR25CcnJYajVWb2FPckhaWVRpNm5xRgptZk81eEdySEtqR1lncEdnYlBUTFNjbFdlcVMzbi9OQThCUE96OElEeWY4Q0F3RUFBYU5XTUZRd0RnWURWUjBQCkFRSC9CQVFEQWdXZ01CTUdBMVVkSlFRTU1Bb0dDQ3NHQVFVRkJ3TUNNQXdHQTFVZEV3RUIvd1FDTUFBd0h3WUQKVlIwakJCZ3dGb0FVMzd6djFIcWZGWjdueXJmUUdUWENoRmphSlZZd0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQgpBRVdxaTY3M0tNZ0tyaHdPRTcxZm40YlBwUlJKY0hhdWNlaWF0d085S1dLRW9IbklRTWN5dlR5QW9DL3B1Y2RMCmN5MVNnVzZEdURjdERDTlhwdGNMc3VKaTltc3lXVFdWV09ONUgwUUpMTHBUblpoUnRUeU1rSU92MzdIekFHTHYKbFJVbzlaUWRuWEpmMS8yTlFsak5TUFNFZGwzYm1aRnh1ZjlDTFA3OVBqVWhCNzJET1N2RVJoYXBaanBCK0JxTwpHdjU1bEhyUG1nUGJicS90NndScUFEN1FSZ1M3ZnpOYjVOT0l3TU5pL29GU0k3anlNeEdleFJTcStrQWpUSHNZCnZlcUNSamszNkF6WUZSb0xsbFM3RURPZlVBWkJST3RicTN0dkpYM0NMemE5OVNyZlk3REpUL1c1N2dna0dFNkkKLzZNcUVOTzNTRlY0TzU2RmsvRGlxRTQ9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K | base64 -d |openssl x509  -noout -text  Certificate:      ...          Subject: CN = system:kube-scheduler

可以看到”用户system:kube-scheduler”绑定了两个角色。

  root@ip-172-31-14-33:~# kubectl get ClusterRoleBindings -o wide |grep system:kube-schedulersystem:kube-scheduler                                  ClusterRole/system:kube-scheduler                                                  31h   system:kube-scheduler  system:volume-scheduler                                ClusterRole/system:volume-scheduler                                                31h   system:kube-scheduler

kubelet的身份和权限

kubelet用的是什么身份?

  root@ip-172-31-14-204:~# ps aux|grep kubelet  root     543967.72.81966128113860 ?      Ssl  08:1429:54 /usr/local/bin/kubelet ... --kubeconfig=/etc/kubernetes/kubelet.conf ...

在worker节点上可以看到kubelet进程参数,api-server信息在/etc/kubernetes/kubelet.conf文件中

可以看到是通过证书认证的

  root@ip-172-31-14-204:/etc/kubernetes/manifests# cat /etc/kubernetes/kubelet.confapiVersion: v1  ...  users:  - name:system:node:ip-172-31-14-33user:      client-certificate: /var/lib/kubelet/pki/kubelet-client-current.pem      client-key: /var/lib/kubelet/pki/kubelet-client-current.pem

查看证书的Subject信息,可以知道证书代表的”用户”是”system:node:ip-172-31-14-204”,”用户组”是”system:nodes”

  root@ip-172-31-14-204:~# openssl x509 -in /var/lib/kubelet/pki/kubelet-client-current.pem -noout -text  Certificate:      ...          Subject: O = system:nodes, CN = system:node:ip-172-31-14-204

那这个kubelet的证书代表的用户能操作哪些资源呢?它可以用来像”集群管理员”那样创建pod吗?

kubelet能操作哪些资源?

按照之前流程,我们来看一下”用户system:node:ip-172-31-14-204”、”用户组system:nodes”在集群中绑定了什么”角色”。

  root@ip-172-31-14-204:~# kubectl get ClusterRoleBinding -A|grep system:nodes  root@ip-172-31-14-204:~# kubectl get ClusterRoleBinding -A|grep "system:node:ip-172-31-14-204"  root@ip-172-31-14-204:~#

会发现”用户和用户组”没有绑定任何一个角色,这和kubectl、kube-scheduler就很不一样了。

在 使用Node鉴权 文档中提到,kube apiserver对kubelet的鉴权比较特殊。

当发现请求的用户在system:nodes组中,用户名是system:node:<nodeName>时,就限制这个请求只能做有限的操作,比如

  • 读操作

    • services

    • pod

    • 绑定到当前node的pod的secret、configMap


  • 写操作(如果开启了NodeRestriction准入插件,就只能修改kubelet所在node的资源)

    • 创建节点、修改节点状态

    • 创建pod、pod状态

    似乎如果没有开启NodeRestriction准入插件,就能让kubelet在任意node上创建pod。

    红蓝对抗中,如果能让kubelet在任意node上创建pod,就能用来横移

    文档中写到,这里的能力可能随着k8s版本变化而变化,以确保kubelet最小权限,默认安全。所以,kubelet到底能操作哪些资源,感觉还是来测试一下比较好,下面就来验证一下kubelet的权限。


验证kubelet的权限

我们先用kubelet配置文件覆盖kubectl的默认配置,然后就可以用kubectl命令来验证。

  root@ip-172-31-14-204:~# mv .kube/config .kube/config.bak  root@ip-172-31-14-204:~# ps aux|grep kubele  root     590757.92.71956332108712 ?      Ssl  03:372:51 /usr/local/bin/kubelet ... --kubeconfig=/etc/kubernetes/kubelet.conf ...  root@ip-172-31-14-204:~# cp /etc/kubernetes/kubelet.conf .kube/config

可以看到不能够创建pod

  root@ip-172-31-14-204:~# kubectl run httpbin --image kennethreitz/httpbin  Error from server (Forbidden): pods "httpbin"is forbidden: pod does not have "kubernetes.io/config.mirror" annotation, node "ip-172-31-14-204" can only create mirror pod

查看pod信息是可以的

  root@ip-172-31-14-204:~# kubectl get pods -A  NAMESPACE                      NAME                                               READY   STATUS      RESTARTS   AGE  default                        tail                                               1/1     Running     025h  kube-system                    calico-kube-controllers-846b5f484d-vzlhw           1/1     Running     027h  ...  root@ip-172-31-14-204:~# kubectl describe pod devops-27558900-m69pc -n kubesphere-devops-system  Name:         devops-27558900-m69pc  ...

查看secret和configMap是不允许的

  root@ip-172-31-14-204:~# kubectl get secrets -A  Error from server (Forbidden): secrets is forbidden: User "system:node:ip-172-31-14-204" cannot list resource "secrets"in API group "" at the cluster scope: can only read namespaced object ofthis type  root@ip-172-31-14-204:~# kubectl get configmap  Error from server (Forbidden): configmaps is forbidden: User "system:node:ip-172-31-14-204" cannot list resource "configmaps"in API group ""in the namespace "default": No Object name found  root@ip-172-31-14-204:~#

小结:kubelet证书可以用来查看pod信息,不能创建pod、不能查看所有命名空间的secret和configMap。看起来和文档中的说明一致。

calico

calico用的是什么身份?

  root@ip-172-31-14-204:~# cat /etc/cni/net.d/calico-kubeconfig# Kubeconfig file for Calico CNI plugin. Installed by calico/node.  ...  users:  - name: calico    user:token: eyJhbGciOiJSUzI1NiIsImtpZCI6ImV6bEstc2QtRTNTaE1ySFg2SWdxMjY2aHpkVFBEWU56SGdfaVdZRXZ4YncifQ.eyJhdWQiOlsiaHR0cHM6Ly9rdWJlcm5ldGVzLmRlZmF1bHQuc3ZjLmNsdXN0ZXIubG9jYWwiXSwiZXhwIjoxNjg1MDIyOTAwLCJpYXQiOjE2NTM0ODY5MDAsImlzcyI6Imh0dHBzOi8va3ViZXJuZXRlcy5kZWZhdWx0LnN2Yy5jbHVzdGVyLmxvY2FsIiwia3ViZXJuZXRlcy5pbyI6eyJuYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsInBvZCI6eyJuYW1lIjoiY2FsaWNvLW5vZGUtcWR0ZmIiLCJ1aWQiOiI4N2U4ZmM3ZC0yYTg5LTQ1OTgtOWQyOC1mZDYyNGIwODk2MDMifSwic2VydmljZWFjY291bnQiOnsibmFtZSI6ImNhbGljby1ub2RlIiwidWlkIjoiOTEzNzUwZWItYmRhNC00YjJmLTgxNjctNDZjOTkxNjk5YWRkIn0sIndhcm5hZnRlciI6MTY1MzQ5MDUwN30sIm5iZiI6MTY1MzQ4NjkwMCwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50Omt1YmUtc3lzdGVtOmNhbGljby1ub2RlIn0.mF1Yek_sSBa2nlQIbdJlEZtv3anjIUFPFpj8Ta8Zn1t6vxYEZjswbPxrw-90sbEVGR30GWytUjr3X1tmjWTP0fL9ltAPvcM0tRg6MoLuGdC2uZFbt-zfKFEn42Yme-NuVOKO3K2otgZNt0ym0gYRT41wLCqOuKLq-SHAkHdvIOZ1eVAu0OsN3ccgSFf2nsuBqbDphd4ShqRPNXl1m66UEDlb4WiPmuSPuzRmMiV706YbBPxMUzn9Ve4o4IfBbeBufp_edSWPPW763EGqZmI7qZg-78SUbtAJ6m8Qkq6TrDIcaJbI3Mrl4EsrnE3v3MGMOogfXXs3-yU-NZl3ilQt6Q  ...

可以看到用的是token令牌。这个token令牌是一个jwt字符串,base64解码后的payload部分如下,可以看到”ServiceAccount”是calico-node,命名空间是kube-system

  {"aud":["https://kubernetes.default.svc.cluster.local"],"exp":1685022900,"iat":1653486900,"iss":"https://kubernetes.default.svc.cluster.local","kubernetes.io":{"namespace":"kube-system","pod":{"name":"calico-node-qdtfb","uid":"87e8fc7d-2a89-4598-9d28-fd624b089603"},"serviceaccount":{"name":"calico-node","uid":"913750eb-bda4-4b2f-8167-46c991699add"},"warnafter":1653490507},"nbf":1653486900,"sub":"system:serviceaccount:kube-system:calico-nodeIn0

可以看到,这个”ServiceAccount”被绑定到了”ClusterRole/calico-node”角色。

  root@ip-172-31-14-204:/home/ubuntu# kubectl get clusterrolebinding -o wide|grep kube-system/calico-node  calico-node                                            ClusterRole/calico-node                                                            34h                                                                                      kube-system/calico-node

pod

pod用的是什么身份?

大部分pod会挂载一个token在/var/run/secrets/kubernetes.io/serviceaccount/token位置,这个token也是一个jwt字符串。

  root@ip-172-31-14-204:/home/ubuntu# kubectl exec -ti tail -- sh  / # cat /var/run/secrets/kubernetes.io/serviceaccount/token  eyJhbGciOiJSUzI1NiIsImtpZCI6ImV6bEstc2QtRTNTaE1ySFg2SWdxMjY2aHpkVFBEWU56SGdfaVdZRXZ4YncifQ.eyJhdWQiOlsiaHR0cHM6Ly9rdWJlcm5ldGVzLmRlZmF1bHQuc3ZjLmNsdXN0ZXIubG9jYWwiXSwiZXhwIjoxNjg1MDk4NTUwLCJpYXQiOjE2NTM1NjI1NTAsImlzcyI6Imh0dHBzOi8va3ViZXJuZXRlcy5kZWZhdWx0LnN2Yy5jbHVzdGVyLmxvY2FsIiwia3ViZXJuZXRlcy5pbyI6eyJuYW1lc3BhY2UiOiJkZWZhdWx0IiwicG9kIjp7Im5hbWUiOiJ0YWlsIiwidWlkIjoiYmQzZGRlZjAtODViYy00MmI4LThjZWYtMjQwZTkwMjViYWQ5In0sInNlcnZpY2VhY2NvdW50Ijp7Im5hbWUiOiJkZWZhdWx0IiwidWlkIjoiZGI5YjQ5MGMtYzU5MS00NDc0LTljOTAtY2U3ZjZmMmRjYjYzIn0sIndhcm5hZnRlciI6MTY1MzU2NjE1N30sIm5iZiI6MTY1MzU2MjU1MCwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50OmRlZmF1bHQ6ZGVmYXVsdCJ9.L388ZKZWvHYf7Yvt6tA7t8k2QMYcsI9BDcYtoxAgOJiEiwf3LKFQmdH8KF4PnI0kjM3Bg80WztFznotwZqCwCNfXMVMl4_iLGHDAgVB3tsdv9ljZ9FUJbn52PD5aWHSWRqjpyQzv8_89dlnnbGQLHg4M8Ly4OkGuWUOnE1x6vgSa1MkjhrnrJEPnnJo5Fy_vyRdvO2A9iyGh7cC97Ns6WWFkeD7741wSkGkoNkZKqJTyfaa_KScprPiVPYuisi4HkYrP71NzZA_i34Dk-IsomySR4h2WWw_88-kfL_lWZ8PDu5NuVekZZ4xfIQjA6oDhXT_Hx4iIlhwVwgYuTW4V-g

base64解码后,payload中也能看到一个服务账号ServiceAccount,这个ServiceAccount也有可能和一个”角色”绑定。你可以动手查看一下自己的pod。

总结

k8s中”X509 客户证书”和”服务账号令牌”应该是身份认证最常见的两种方式,都能代表”用户”或”用户组”信息。

大部分的组件(包括scheduler、calico、kubectl、pod)鉴权都是依赖RBAC模型,也就是”用户或”用户组”绑定的”角色”规定了能访问哪些资源。

kubelet的鉴权比较特殊,是依赖Node鉴权模型。

用户认证 文档中还提到api访问控制的其他方法。


】【打印关闭】 【返回顶部
分享到QQ空间
分享到: 
上一篇Android 恶意软件已从 Google Pla.. 下一篇Android恶意软件Sharkbot通过防病..

立足首都,辐射全球,防御吧专注云防御及云计算服务15年!

联系我们

服务热线:010-56157787 ,010-56159998
企业QQ:4000043998
技术支持:010-56159998
E-Mail:800@fangyuba.com
Copyright ? 2003-2016 fangyuba. 防御吧(完美解决防御与加速) 版权所有 增值许可:京B2-20140042号
售前咨询
公司总机:4000043998 01056155355
24小时电话:010-56159998
投诉电话:18910191973
值班售后/技术支持
售后服务/财务
备案专员
紧急电话:18610088800