Not Able To Create Pod in Kubernetes Version: v1.10.0-beta.3
When I create pod on the master node I face the following error:
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\
executed command : openssl genrsa -out /tmp/serviceaccount.ket 2048
modified the /etc/kubernetes/apiserver
file to add following :
KUBE_API_ARGS="--service_account_key_file=/tmp/serviceaccount.key"
modified the /etc/kubernetes/controller-manager
and add following:
KUBE_CONTROLLER_MANAGER_ARGS="--
service_account_private_key_file=/tmp/serviceaccount.key"
restarted the Kubernetes but I face still the same error:
No API token found for service account \"default\", retry after the token is automatically created and added to the service account\
An another way remove SecurityContextDeny,ServiceAccount on apiservice before:
KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota"
after:
KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,LimitRanger,ResourceQuota"
still error:
No API token found for service account \"default\", retry after the token is automatically created and added to the service account\
How can I solve it?
I faced same issue, and followed following steps.
Verify following things as well
kubectl get serviceaccounts --> Output must show default account with one secret.
kubectl get secrets --> Output must have default token for service account
kubectl describe secrets/default-token-qxxw6 --> It must show ca.crt and token under Data section
If nothing works then stop your cluster,s all services on Master and Nodes. Then remove clean ETCD DB, load your network configs to ETCD and start the cluster as a fresh cluster.