码迷,mamicode.com
首页 > Web开发 > 详细

kubernetes logs 命令错误记录

时间:2019-10-08 23:52:41      阅读:680      评论:0      收藏:0      [点我收藏+]

标签:net   rdf   enabled   domain   div   bre   角色   修改   als   

[root@k8s-master ~]# kubectl logs nginx-dbddb74b8-j9rdf
error: You must be logged in to the server (the server has asked for the client to provide credentials ( pods/log nginx-dbddb74b8-j9rdf))
解决办法修改:/opt/kubernetes/cfg/kubelet.config添加
authentication:
  anonymous:
    enabled: true
 [root@k8s-node1 cfg]# cat kubelet.config 
kind: KubeletConfiguration
apiVersion: kubelet.config.k8s.io/v1beta1
address: 192.168.1.120
port: 10250
cgroupDriver: cgroupfs
clusterDNS:
- 10.0.0.2 
clusterDomain: cluster.local.
failSwapOn: false
authentication:
  anonymous:
    enabled: true

[root@k8s-master ~]# kubectl logs nginx-dbddb74b8-j9rdf
Error from server (Forbidden): Forbidden (user=system:anonymous, verb=get, resource=nodes, subresource=proxy) ( pods/log nginx-dbddb74b8-j9rdf)
解决办法:将system:anonymous绑定到cluster-admin角色中 起个cluster-system:anonymous名字
[root@k8s-master ~]# kubectl create clusterrolebinding cluster-system:anonymous --clusterrole=cluster-admin --user=system:anonymous
clusterrolebinding.rbac.authorization.k8s.io/cluster-system:anonymous created

  

kubernetes logs 命令错误记录

标签:net   rdf   enabled   domain   div   bre   角色   修改   als   

原文地址:https://www.cnblogs.com/caonw/p/11638408.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!