kubectl exec 遇到Error from server forbidden问题
问题:[root@k8s-master yaml_all]# kubectl get poNAMEREADYSTATUSRESTARTSAGEnginx-648b5cc477-7b5pt1/1Running03h41mnginx-648b5cc477-mplmg1/1Ru...
·
问题:
[root@k8s-master yaml_all]# kubectl get po
NAME READY STATUS RESTARTS AGE
nginx-648b5cc477-7b5pt 1/1 Running 0 3h41m
nginx-648b5cc477-mplmg 1/1 Running 0 3h41m
nginx-648b5cc477-zw8jq 1/1 Running 0 3h41m
执行下面这条后报错了
[root@k8s-master yaml_all]# kubectl exec -it nginx-648b5cc477-7b5pt bash
error: unable to upgrade connection: Forbidden (user=system:anonymous, verb=create, resource=nodes, subresource=proxy)
临时解决方法:
绑定一个cluster-admin的权限
[root@k8s-master yaml_all]# kubectl create clusterrolebinding system:anonymous --clusterrole=cluster-admin --user=system:anonymous
clusterrolebinding.rbac.authorization.k8s.io/system:anonymous created
[root@k8s-master yaml_all]# kubectl exec -it nginx-648b5cc477-7b5pt -- bash
root@nginx-648b5cc477-7b5pt:/# ls
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
root@nginx-648b5cc477-7b5pt:/# exit
exit
转载于:https://blog.51cto.com/11288550/2378291
更多推荐
已为社区贡献466条内容
所有评论(0)