kubectl describe replicationcontrollers/mysql
Error creating: No API token found for service account "default", retry after the token is automatically created and added to the service account
在網路 google 了一下,得到的解答如下:
- disable KUBE_ADMISSION_CONTROL
使用 vi 打開 /etc/kubernetes/apiserver,找到 KUBE_ADMISSION_CONTROL 把原來的設定用 # 註解掉,然後加上 KUBE_ADMISSION_CONTROL="" 後存檔。
- 重啟 kube-apiserver
在命令列執行:
systemctl restart kube-apiserver
接下來我用如下指令:
kubectl get pods
NAME READY STATUS RESTARTS AGE
mysql-14w74 0/1 ContainerCreating 0 3h
Pod 一直在 ContainerCreating 的狀態,我再用這個指令查一下原因:
kubectl describe pods mysql-14w74
1m 34s 3 {kubelet 127.0.0.1} Warning FailedSync Error syncing pod, skipping: failed to “StartContainer” for “POD” with ErrImagePull: “image pull failed for registry.access.redhat.com/rhel7/pod-infrastructure:latest, this may be because there are no credentials on this request. details: (open /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt: no such file or directory)”
大意是有些鏡像拉不下來 … 解決辦法是先安裝 rhsm ...
yum install *rhsm*
再把相關的鏡像手動拉下來 …
docker pull registry.access.redhat.com/rhel7/pod-infrastructure:latest
刪除原有不正常的 rc 和 pods 並重新 create 就可以了,如下:
kubectl delete pods mysql-14w74 kubectl delete rc mysql kubectl create -f mysql-rc.yaml
沒有留言:
張貼留言