Error from server (Forbidden): deployments.apps is forbidden: User "system:node:node02" cannot list resource "deployments" in API group "apps" in the namespace "default"

从节点执行kubectl   get   deployment报错 Error from server (Forbidden): deployments.apps is forbidden: User "system:node:node02" cannot list resource "deployments" in API group "apps" in the namespace "default"

[root@node02 ~]# kubectl get deployment
Error from server (Forbidden): deployments.apps is forbidden: User "system:node:node02" cannot list resource "deployments" in API group "apps" in the namespace "default"

解决办法:复制主节点的配置文件到从节点

[root@master .kube]# scp config root@192.168.43.38:/root/.kube/
root@192.168.43.38's password: 
config                                                                                 100% 5645     1.5MB/s   00:00  

再次从节点尝试

[root@node01 .kube]# kubectl get deployment
No resources found in default namespace.

 

posted @ 2024-02-18 15:26  中仕  阅读(96)  评论(0编辑  收藏  举报