k8s出现的问题:(ServerTimeout): error when creating "k8s_pod.yml": No API token found for service
错误提示:Error from server (ServerTimeout): error when creating “k8s_pod.yml”: No API token found for service account “default”, retry after the token is automatically created and adde问题分析:来自服务器的错误(Serv..
错误提示:
Error from server (ServerTimeout): error when creating “k8s_pod.yml”: No API token found for service account “default”, retry after the token is automatically created and adde
问题分析:来自服务器的错误(ServerTimeout):创建“k8s_pod”时出错。yml”:服务帐户“default”没有找到API令牌,请在令牌被自动创建并添加到服务帐户后重试
解决办法1:
因为在apiserver里面有一个这样的配置
KUBE_ADMISSION_CONTROL="–admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota"
我们只需要注释掉这条就行
#KUBE_ADMISSION_CONTROL="–admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota"
然后重启apiserver
systemctl restart kube-apiserver
解决办法2:
配置ServiceAccount
1.生成秘钥
openssl genrsa -out /etc/kubernetes/service.key 2048
2.添加参数
vim /etc/kubenetes/apiserver
KUBE_API_ARGS="–service_account_key_file=/etc/kubernetes/service.key"
vim /etc/kubernetes/controller-manager
KUBE_CONTROLLER_MANAGER_ARGS="–
service_account_private_key_file=/etc/kubernetes/service.key"
3.重启服务
systemctl restart kube-apiserver
更多推荐
所有评论(0)