【发布时间】:2018-08-24 01:10:13
【问题描述】:
无法在 Kubernetes 中创建 Pod 版本:v1.10.0-beta.3
当我在主节点上创建 pod 时,我遇到以下错误:
kubectl create -f ./nginx-rc.yaml
ERROR:
No API token found for service account \"default\", retry after the token is automatically created and added to the service account\
执行命令:
openssl genrsa -out /tmp/serviceaccount.ket 2048-
修改
/etc/kubernetes/apiserver文件以添加以下内容:KUBE_API_ARGS="--service_account_key_file=/tmp/serviceaccount.key" -
修改
/etc/kubernetes/controller-manager并添加以下内容:KUBE_CONTROLLER_MANAGER_ARGS="-- service_account_private_key_file=/tmp/serviceaccount.key" -
重新启动了 Kubernetes,但我仍然遇到同样的错误:
No API token found for service account \"default\", retry after the token is automatically created and added to the service account\
在 apiservice 上删除 SecurityContextDeny,ServiceAccount 的另一种方法 之前:
KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota"
之后:
KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,LimitRanger,ResourceQuota"
还是报错:
No API token found for service account \"default\", retry after the token is automatically created and added to the service account\
我该如何解决?
【问题讨论】:
-
您是否对这个 pod 也有问题,例如
kubectl run nginx --image=nginx?您使用的是 google-kubernetes-engine 吗?因为您无法在 Google Cloud 实现中的 master 上运行 pod,而且我认为 v1.10 不可用,所以我认为您使用了错误的标签。 -
你找到解决办法了吗?
标签: kubernetes kubernetes-security