无法 运行 kubernetes 集群(Digital Ocean)上的 pods ErrImagePull
Unable to run the pods on the kubernetes cluster (Digital Ocean) ErrImagePull
我是 docker/k8s 的新手。我 运行 在我的本地机器上安装了一个简单的 Nodejs 应用程序。我正在使用支架。
现在我正在尝试 运行 在 Kubernetes 集群数字海洋上做同样的事情。我收到以下错误:
Error: container auth is waiting to start: rehanpunjwani/auth:655249efc5a2a82370b44d76bbfc09e50c11ba6316492f4753a03073f48ee83c can't be pulled.
我的 pod 状态是 ErrImagePull。
我试图查看 pods 中显示以下失败的事件:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 5m10s default-scheduler Successfully assigned default/auth-699894675-66pwq to xc-k8s-dev-30pnw
Normal Pulling 4m54s (x2 over 5m7s) kubelet Pulling image "rehanpunjwani/auth:655249efc5a2a82370b44d76bbfc09e50c11ba6316492f4753a03073f48ee83c"
Warning Failed 4m53s (x2 over 5m5s) kubelet Failed to pull image "rehanpunjwani/auth:655249efc5a2a82370b44d76bbfc09e50c11ba6316492f4753a03073f48ee83c": rpc error: code = Unknown desc = Error response from daemon: manifest for rehanpunjwani/auth:655249efc5a2a82370b44d76bbfc09e50c11ba6316492f4753a03073f48ee83c not found: manifest unknown: manifest unknown
Warning Failed 4m53s (x2 over 5m5s) kubelet Error: ErrImagePull
Normal SandboxChanged 4m47s (x7 over 5m5s) kubelet Pod sandbox changed, it will be killed and re-created.
Normal BackOff 4m46s (x6 over 5m2s) kubelet Back-off pulling image "rehanpunjwani/auth:655249efc5a2a82370b44d76bbfc09e50c11ba6316492f4753a03073f48ee83c"
Warning Failed 4m46s (x6 over 5m2s) kubelet Error: ImagePullBackOff
错误仅出现在数字海洋中。
我试图搜索问题但无法解决问题。该错误与从 docker 中提取图像有关。我的回购是 public 但我仍然无法提取它。
谁能帮我解决这个问题?
编辑 1:
我的auth-depl.yaml是这样的:
apiVersion: apps/v1
kind: Deployment
metadata:
name: auth
spec:
replicas: 1
selector:
matchLabels:
app: auth
template:
metadata:
labels:
app: auth
spec:
containers:
- name: auth
image: rehanpunjwani/auth:latest
env:
- name: JWT_KEY
valueFrom:
secretKeyRef:
name: jwt-secret
key: JWT_KEY
---
编辑 2:
kubectl get pod -o yaml -l app=auth
的输出
apiVersion: v1
items:
- apiVersion: v1
kind: Pod
metadata:
creationTimestamp: "2021-01-20T11:22:48Z"
generateName: auth-6c596959dc-
labels:
app: auth
app.kubernetes.io/managed-by: skaffold
pod-template-hash: 6c596959dc
skaffold.dev/run-id: d99c01da-cb0b-49e8-bcb8-98ecd6d1c9f9
managedFields:
- apiVersion: v1
fieldsType: FieldsV1
fieldsV1:
f:metadata:
f:generateName: {}
f:labels:
.: {}
f:app: {}
f:app.kubernetes.io/managed-by: {}
f:pod-template-hash: {}
f:skaffold.dev/run-id: {}
f:ownerReferences:
.: {}
k:{"uid":"a0c69a6b-fe95-4bed-8630-6abbae1d97f9"}:
.: {}
f:apiVersion: {}
f:blockOwnerDeletion: {}
f:controller: {}
f:kind: {}
f:name: {}
f:uid: {}
f:spec:
f:containers:
k:{"name":"auth"}:
.: {}
f:env:
.: {}
k:{"name":"JWT_KEY"}:
.: {}
f:name: {}
f:valueFrom:
.: {}
f:secretKeyRef:
.: {}
f:key: {}
f:name: {}
f:image: {}
f:imagePullPolicy: {}
f:name: {}
f:resources: {}
f:terminationMessagePath: {}
f:terminationMessagePolicy: {}
f:dnsPolicy: {}
f:enableServiceLinks: {}
f:restartPolicy: {}
f:schedulerName: {}
f:securityContext: {}
f:terminationGracePeriodSeconds: {}
manager: kube-controller-manager
operation: Update
time: "2021-01-20T11:22:48Z"
- apiVersion: v1
fieldsType: FieldsV1
fieldsV1:
f:status:
f:conditions:
k:{"type":"ContainersReady"}:
.: {}
f:lastProbeTime: {}
f:lastTransitionTime: {}
f:message: {}
f:reason: {}
f:status: {}
f:type: {}
k:{"type":"Initialized"}:
.: {}
f:lastProbeTime: {}
f:lastTransitionTime: {}
f:status: {}
f:type: {}
k:{"type":"Ready"}:
.: {}
f:lastProbeTime: {}
f:lastTransitionTime: {}
f:message: {}
f:reason: {}
f:status: {}
f:type: {}
f:containerStatuses: {}
f:hostIP: {}
f:podIP: {}
f:podIPs:
.: {}
k:{"ip":"10.244.0.22"}:
.: {}
f:ip: {}
f:startTime: {}
manager: kubelet
operation: Update
time: "2021-01-20T11:26:07Z"
name: auth-6c596959dc-9ghtg
namespace: default
ownerReferences:
- apiVersion: apps/v1
blockOwnerDeletion: true
controller: true
kind: ReplicaSet
name: auth-6c596959dc
uid: a0c69a6b-fe95-4bed-8630-6abbae1d97f9
resourceVersion: "1994444"
selfLink: /api/v1/namespaces/default/pods/auth-6c596959dc-9ghtg
uid: c64653af-d17c-4c96-bea1-338b50b04567
spec:
containers:
- env:
- name: JWT_KEY
valueFrom:
secretKeyRef:
key: JWT_KEY
name: jwt-secret
image: rehanpunjwani/auth:b902346e89a8f523f5b9f281921bf2413a4686148045523670c26653e66d8526
imagePullPolicy: IfNotPresent
name: auth
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
name: default-token-drzwc
readOnly: true
dnsPolicy: ClusterFirst
enableServiceLinks: true
imagePullSecrets:
- name: regcred
nodeName: xc-k8s-dev-30png
preemptionPolicy: PreemptLowerPriority
priority: 0
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
serviceAccount: default
serviceAccountName: default
terminationGracePeriodSeconds: 30
tolerations:
- effect: NoExecute
key: node.kubernetes.io/not-ready
operator: Exists
tolerationSeconds: 300
- effect: NoExecute
key: node.kubernetes.io/unreachable
operator: Exists
tolerationSeconds: 300
volumes:
- name: default-token-drzwc
secret:
defaultMode: 420
secretName: default-token-drzwc
status:
conditions:
- lastProbeTime: null
lastTransitionTime: "2021-01-20T11:22:48Z"
status: "True"
type: Initialized
- lastProbeTime: null
lastTransitionTime: "2021-01-20T11:22:48Z"
message: 'containers with unready status: [auth]'
reason: ContainersNotReady
status: "False"
type: Ready
- lastProbeTime: null
lastTransitionTime: "2021-01-20T11:22:48Z"
message: 'containers with unready status: [auth]'
reason: ContainersNotReady
status: "False"
type: ContainersReady
- lastProbeTime: null
lastTransitionTime: "2021-01-20T11:22:48Z"
status: "True"
type: PodScheduled
containerStatuses:
- image: rehanpunjwani/auth:b902346e89a8f523f5b9f281921bf2413a4686148045523670c26653e66d8526
imageID: ""
lastState: {}
name: auth
ready: false
restartCount: 0
started: false
state:
waiting:
message: Back-off pulling image "rehanpunjwani/auth:b902346e89a8f523f5b9f281921bf2413a4686148045523670c26653e66d8526"
reason: ImagePullBackOff
hostIP: 10.110.0.3
phase: Pending
podIP: 10.244.0.22
podIPs:
- ip: 10.244.0.22
qosClass: BestEffort
startTime: "2021-01-20T11:22:48Z"
kind: List
metadata:
resourceVersion: ""
selfLink: ""```
问题是,您的图片不存在:
rehanpunjwani/auth:655249efc5a2a82370b44d76bbfc09e50c11ba6316492f4753a03073f48ee83c
尝试在您的本地计算机上运行此命令。
docker pull rehanpunjwani/auth:655249efc5a2a82370b44d76bbfc09e50c11ba6316492f4753a03073f48ee83c
如果这是不正确的图像,请将您的 yaml 文件更改为 Pod/deployment
问题出在 skaffold cli 上。使 build.local.push = true
解决了我的问题。
deploy:
kubectl:
manifests:
- ./infra/k8s/*
build:
local:
push: true #Here it was false
我是 docker/k8s 的新手。我 运行 在我的本地机器上安装了一个简单的 Nodejs 应用程序。我正在使用支架。
现在我正在尝试 运行 在 Kubernetes 集群数字海洋上做同样的事情。我收到以下错误:
Error: container auth is waiting to start: rehanpunjwani/auth:655249efc5a2a82370b44d76bbfc09e50c11ba6316492f4753a03073f48ee83c can't be pulled.
我的 pod 状态是 ErrImagePull。 我试图查看 pods 中显示以下失败的事件:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 5m10s default-scheduler Successfully assigned default/auth-699894675-66pwq to xc-k8s-dev-30pnw
Normal Pulling 4m54s (x2 over 5m7s) kubelet Pulling image "rehanpunjwani/auth:655249efc5a2a82370b44d76bbfc09e50c11ba6316492f4753a03073f48ee83c"
Warning Failed 4m53s (x2 over 5m5s) kubelet Failed to pull image "rehanpunjwani/auth:655249efc5a2a82370b44d76bbfc09e50c11ba6316492f4753a03073f48ee83c": rpc error: code = Unknown desc = Error response from daemon: manifest for rehanpunjwani/auth:655249efc5a2a82370b44d76bbfc09e50c11ba6316492f4753a03073f48ee83c not found: manifest unknown: manifest unknown
Warning Failed 4m53s (x2 over 5m5s) kubelet Error: ErrImagePull
Normal SandboxChanged 4m47s (x7 over 5m5s) kubelet Pod sandbox changed, it will be killed and re-created.
Normal BackOff 4m46s (x6 over 5m2s) kubelet Back-off pulling image "rehanpunjwani/auth:655249efc5a2a82370b44d76bbfc09e50c11ba6316492f4753a03073f48ee83c"
Warning Failed 4m46s (x6 over 5m2s) kubelet Error: ImagePullBackOff
错误仅出现在数字海洋中。 我试图搜索问题但无法解决问题。该错误与从 docker 中提取图像有关。我的回购是 public 但我仍然无法提取它。
谁能帮我解决这个问题?
编辑 1: 我的auth-depl.yaml是这样的:
apiVersion: apps/v1
kind: Deployment
metadata:
name: auth
spec:
replicas: 1
selector:
matchLabels:
app: auth
template:
metadata:
labels:
app: auth
spec:
containers:
- name: auth
image: rehanpunjwani/auth:latest
env:
- name: JWT_KEY
valueFrom:
secretKeyRef:
name: jwt-secret
key: JWT_KEY
---
编辑 2:
kubectl get pod -o yaml -l app=auth
apiVersion: v1
items:
- apiVersion: v1
kind: Pod
metadata:
creationTimestamp: "2021-01-20T11:22:48Z"
generateName: auth-6c596959dc-
labels:
app: auth
app.kubernetes.io/managed-by: skaffold
pod-template-hash: 6c596959dc
skaffold.dev/run-id: d99c01da-cb0b-49e8-bcb8-98ecd6d1c9f9
managedFields:
- apiVersion: v1
fieldsType: FieldsV1
fieldsV1:
f:metadata:
f:generateName: {}
f:labels:
.: {}
f:app: {}
f:app.kubernetes.io/managed-by: {}
f:pod-template-hash: {}
f:skaffold.dev/run-id: {}
f:ownerReferences:
.: {}
k:{"uid":"a0c69a6b-fe95-4bed-8630-6abbae1d97f9"}:
.: {}
f:apiVersion: {}
f:blockOwnerDeletion: {}
f:controller: {}
f:kind: {}
f:name: {}
f:uid: {}
f:spec:
f:containers:
k:{"name":"auth"}:
.: {}
f:env:
.: {}
k:{"name":"JWT_KEY"}:
.: {}
f:name: {}
f:valueFrom:
.: {}
f:secretKeyRef:
.: {}
f:key: {}
f:name: {}
f:image: {}
f:imagePullPolicy: {}
f:name: {}
f:resources: {}
f:terminationMessagePath: {}
f:terminationMessagePolicy: {}
f:dnsPolicy: {}
f:enableServiceLinks: {}
f:restartPolicy: {}
f:schedulerName: {}
f:securityContext: {}
f:terminationGracePeriodSeconds: {}
manager: kube-controller-manager
operation: Update
time: "2021-01-20T11:22:48Z"
- apiVersion: v1
fieldsType: FieldsV1
fieldsV1:
f:status:
f:conditions:
k:{"type":"ContainersReady"}:
.: {}
f:lastProbeTime: {}
f:lastTransitionTime: {}
f:message: {}
f:reason: {}
f:status: {}
f:type: {}
k:{"type":"Initialized"}:
.: {}
f:lastProbeTime: {}
f:lastTransitionTime: {}
f:status: {}
f:type: {}
k:{"type":"Ready"}:
.: {}
f:lastProbeTime: {}
f:lastTransitionTime: {}
f:message: {}
f:reason: {}
f:status: {}
f:type: {}
f:containerStatuses: {}
f:hostIP: {}
f:podIP: {}
f:podIPs:
.: {}
k:{"ip":"10.244.0.22"}:
.: {}
f:ip: {}
f:startTime: {}
manager: kubelet
operation: Update
time: "2021-01-20T11:26:07Z"
name: auth-6c596959dc-9ghtg
namespace: default
ownerReferences:
- apiVersion: apps/v1
blockOwnerDeletion: true
controller: true
kind: ReplicaSet
name: auth-6c596959dc
uid: a0c69a6b-fe95-4bed-8630-6abbae1d97f9
resourceVersion: "1994444"
selfLink: /api/v1/namespaces/default/pods/auth-6c596959dc-9ghtg
uid: c64653af-d17c-4c96-bea1-338b50b04567
spec:
containers:
- env:
- name: JWT_KEY
valueFrom:
secretKeyRef:
key: JWT_KEY
name: jwt-secret
image: rehanpunjwani/auth:b902346e89a8f523f5b9f281921bf2413a4686148045523670c26653e66d8526
imagePullPolicy: IfNotPresent
name: auth
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
name: default-token-drzwc
readOnly: true
dnsPolicy: ClusterFirst
enableServiceLinks: true
imagePullSecrets:
- name: regcred
nodeName: xc-k8s-dev-30png
preemptionPolicy: PreemptLowerPriority
priority: 0
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
serviceAccount: default
serviceAccountName: default
terminationGracePeriodSeconds: 30
tolerations:
- effect: NoExecute
key: node.kubernetes.io/not-ready
operator: Exists
tolerationSeconds: 300
- effect: NoExecute
key: node.kubernetes.io/unreachable
operator: Exists
tolerationSeconds: 300
volumes:
- name: default-token-drzwc
secret:
defaultMode: 420
secretName: default-token-drzwc
status:
conditions:
- lastProbeTime: null
lastTransitionTime: "2021-01-20T11:22:48Z"
status: "True"
type: Initialized
- lastProbeTime: null
lastTransitionTime: "2021-01-20T11:22:48Z"
message: 'containers with unready status: [auth]'
reason: ContainersNotReady
status: "False"
type: Ready
- lastProbeTime: null
lastTransitionTime: "2021-01-20T11:22:48Z"
message: 'containers with unready status: [auth]'
reason: ContainersNotReady
status: "False"
type: ContainersReady
- lastProbeTime: null
lastTransitionTime: "2021-01-20T11:22:48Z"
status: "True"
type: PodScheduled
containerStatuses:
- image: rehanpunjwani/auth:b902346e89a8f523f5b9f281921bf2413a4686148045523670c26653e66d8526
imageID: ""
lastState: {}
name: auth
ready: false
restartCount: 0
started: false
state:
waiting:
message: Back-off pulling image "rehanpunjwani/auth:b902346e89a8f523f5b9f281921bf2413a4686148045523670c26653e66d8526"
reason: ImagePullBackOff
hostIP: 10.110.0.3
phase: Pending
podIP: 10.244.0.22
podIPs:
- ip: 10.244.0.22
qosClass: BestEffort
startTime: "2021-01-20T11:22:48Z"
kind: List
metadata:
resourceVersion: ""
selfLink: ""```
问题是,您的图片不存在:
rehanpunjwani/auth:655249efc5a2a82370b44d76bbfc09e50c11ba6316492f4753a03073f48ee83c
尝试在您的本地计算机上运行此命令。
docker pull rehanpunjwani/auth:655249efc5a2a82370b44d76bbfc09e50c11ba6316492f4753a03073f48ee83c
如果这是不正确的图像,请将您的 yaml 文件更改为 Pod/deployment
问题出在 skaffold cli 上。使 build.local.push = true
解决了我的问题。
deploy:
kubectl:
manifests:
- ./infra/k8s/*
build:
local:
push: true #Here it was false