其他分享
首页 > 其他分享> > RBAC---用户

RBAC---用户

作者:互联网

创建用户
cfssl gencert -ca=ca.crt -ca-key=ca.key -profile=kubernetes /opt/yaml/RBAC/user.json | cfssljson -bare clerk

export KUBE_APISERVER="https://10.72.40.16:6443"

kubectl config set-cluster kubernetes
--certificate-authority=/etc/kubernetes/pki/ca.crt
--embed-certs=true
--server=${KUBE_APISERVER}
--kubeconfig=clerk.kubeconfig


设置客户端认证参数
kubectl config set-credentials clerk
--client-certificate=/etc/kubernetes/pki/clerk.pem
--client-key=/etc/kubernetes/pki/clerk-key.pem
--embed-certs=true
--kubeconfig=clerk.kubeconfig


设置上下文参数
kubectl config set-context kubernetes
--cluster=kubernetes
--user=clerk
--namespace=thanos
--kubeconfig=clerk.kubeconfig


设置默认上下文
kubectl config use-context kubernetes --kubeconfig=.kube/config


role-binding
kubectl create rolebinding clerk-admin-binding --clusterrole=admin --user=clerk --namespace=thanos

标签:---,kubernetes,kubectl,--,clerk,用户,kubeconfig,RBAC,ca
来源: https://www.cnblogs.com/tian-jun-cs/p/15234349.html