最近剛剛入手研究kubernetes,運行容器的時候,發現一直處於ContainerCreating狀態,悲了個催,剛入手就遇到了點麻煩,下面來說講如何查找問題及解決的
redis
運行容器命令:docker
kubectl -f create redis.yamlide
kubectl get pod redisui
NAME READY STATUS RESTARTS AGE
redis-master-6jgsl 0/1 ContainerCreating 0 12sthis
一直處於ContainerCreating,沒有處於running狀態spa
查看相關日誌日誌
kubectl describe pod redis-6jgslorm
Name: redis-master-6jgsl
Namespace: default
Node: 127.0.0.1/127.0.0.1
Start Time: Wed, 20 Sep 2017 09:07:39 +0800
Labels: name=redis-master
Status: Pending
IP:
Controllers: ReplicationController/redis-master
Containers:
master:
Container ID:
Image: kubeguide/redis-master
Image ID:
Port: 6379/TCP
State: Waiting
Reason: ContainerCreating
Ready: False
Restart Count: 0
Volume Mounts: <none>
Environment Variables: <none>
Conditions:
Type Status
Initialized True
Ready False
PodScheduled True
No volumes.
QoS Class: BestEffort
Tolerations: <none>
Events:
FirstSeen LastSeen Count From SubObjectPath Type Reason Message
--------- -------- ----- ---- ------------- -------- ------ -------
1m 1m 1 {default-scheduler } Normal Scheduled Successfully assigned redis-master-6jgsl to 127.0.0.1
1m 47s 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)"
1m 10s 4 {kubelet 127.0.0.1} Warning FailedSync Error syncing pod, skipping: failed to "StartContainer" for "POD" with ImagePullBackOff: "Back-off pulling image \"registry.access.redhat.com/rhel7/pod-infrastructure:latest\""blog
看到registry.access.redhat.com/rhel7/pod-infrastructure:latest感受很奇怪,我設置的倉庫是grc.io,爲何去拉取這個鏡像,懷疑是否是什麼沒有安裝好。嘗試運行docker pull registry.access.redhat.com/rhel7/pod-infrastructure:latest,提示redhat-ca.crt: no such file or directory。ls查看改文件是個軟鏈接,連接目標是/etc/rhsm,查看沒有rhsm,嘗試安裝yum install *rhsm*,出現相關軟件,感受比較符合,因此安裝查看產生了/etc/rhsm文件夾。ip
再次運行kubectl get pods
NAME READY STATUS RESTARTS AGEredis-master-qhd12 1/1 Running 0 13m