我在macOS 10.12上使用minikube並嘗試使用在碼頭中心託管的私人圖像。我知道minikube啓動一個虛擬機,據我所知,它將是我本地kubernetes集羣的唯一節點,並將託管我所有的pod。使用minikube從碼頭中心拉私人圖像
我讀到我可以通過運行eval $(minikube docker-env)
來使用虛擬機的docker運行時。所以我使用這些變量從本地Docker運行時更改爲另一個。正在運行docker images
我可以看到變更已經完成。
我的下一步就是使用docker login
然後手工拉我的形象泊塢窗樞紐,這沒有錯誤結束登錄。之後,我認爲圖像將隨時被羣集中的任何羣組使用,但我總是得到ImagePullBackOff
。我也嘗試通過minikube ssh
ssh進入虛擬機,結果是一樣的,圖像是在那裏使用,但由於某種原因,我不知道它拒絕使用它。
萬一有幫助,這是我的部署描述文件:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: web-deployment
spec:
replicas: 1
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: godraude/nginx
imagePullPolicy: Always
ports:
- containerPort: 80
- containerPort: 443
這是kubectl describe pod <podname>
輸出:
Events:
FirstSeen LastSeen Count From SubobjectPath Type Reason Message
--------- -------- ----- ---- ------------- -------- ------ -------
1m 1m 1 {default-scheduler } Normal Scheduled Successfully assigned web-deployment-2451628605-vtbl8 to minikube
1m 23s 4 {kubelet minikube} spec.containers{nginx} Normal Pulling pulling image "godraude/nginx"
1m 20s 4 {kubelet minikube} spec.containers{nginx} Warning Failed Failed to pull image "godraude/nginx": Error: image godraude/nginx not found
1m 20s 4 {kubelet minikube} Warning FailedSync Error syncing pod, skipping: failed to "StartContainer" for "nginx" with ErrImagePull: "Error: image godraude/nginx not found"
1m 4s 5 {kubelet minikube} spec.containers{nginx} Normal BackOff Back-off pulling image "godraude/nginx"
1m 4s 5 {kubelet minikube} Warning FailedSync Error syncing pod, skipping: failed to "StartContainer" for "nginx" with ImagePullBackOff: "Back-off pulling image \"godraude/nginx\""