簡體   English   中英

港口登記處:無法在Kubernetes中提取圖像

[英]Harbor Registry: Failed to pull image in Kubernetes

我建立了一個港口登記處,成功運作了幾個星期。 對於每個部署和命名空間,我都有一個秘密,其中包含來自〜/ .docker / config.json文件的憑據,以訪問注冊表。 自上周末以來,我再也無法從該注冊表中提取圖像了,我沒有改變任何東西! 群集在GKE v1.12.5 btw上運行。

什么有用? 我可以從我當地的機器女巫碼頭拉動和推動圖像。

什么不起作用? 我的Kubernetes集群不能再拉圖像並在超時運行。

Events:
  Type     Reason          Age                  From                                                       Message
  ----     ------          ----                 ----                                                       -------
  Normal   Scheduled       13m                  default-scheduler                                          Successfully assigned k8s-test7/nginx-k8s-test7-6f7b8fdd79-2ffmp to gke-k8s-cloudops-test-default-pool-72fccd21-hrhk
  Normal   SandboxChanged  12m                  kubelet, gke-k8s-cloudops-test-default-pool-72fccd21-hrhk  Pod sandbox changed, it will be killed and re-created.
  Warning  Failed          11m (x3 over 12m)    kubelet, gke-k8s-cloudops-test-default-pool-72fccd21-hrhk  Failed to pull image "core.k8s-harbor-test.my-domain.com/nginx-test/nginx:1.15.10": rpc error: code = Unknown desc = Error response from daemon: Get https://core.k8s-harbor-test.my-domain.com/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
  Warning  Failed          11m (x3 over 12m)    kubelet, gke-k8s-cloudops-test-default-pool-72fccd21-hrhk  Error: ErrImagePull
  Normal   BackOff         11m (x7 over 12m)    kubelet, gke-k8s-cloudops-test-default-pool-72fccd21-hrhk  Back-off pulling image "core.k8s-harbor-test.my-domain.com/nginx-test/nginx:1.15.10"
  Normal   Pulling         10m (x4 over 13m)    kubelet, gke-k8s-cloudops-test-default-pool-72fccd21-hrhk  pulling image "core.k8s-harbor-test.my-domain.com/nginx-test/nginx:1.15.10"
  Warning  Failed          3m2s (x38 over 12m)  kubelet, gke-k8s-cloudops-test-default-pool-72fccd21-hrhk  Error: ImagePullBackOff

deployment.yaml

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: nginx-k8s-test7
  namespace: k8s-test7
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: nginx-k8s-test7
    spec:
      containers:
      - name: nginx-k8s-test7
        image: core.k8s-harbor-test.my-domain.com/nginx-test/nginx:1.15.10
        volumeMounts:
          - name: webcontent
            mountPath: /usr/share/nginx/html
        ports:
        - containerPort: 80
      volumes:
        - name: webcontent
          configMap:
            name: webcontent
      imagePullSecrets:
      - name: harborcred
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: webcontent
  namespace: k8s-test7
  annotations:
    volume.alpha.kubernetes.io/storage-class: default
spec:
  accessModes: [ReadWriteOnce]
  resources:
    requests:
      storage: 5Gi

秘密“harborcred”是每個命名空間的一部分,以便部署可以訪問它。 秘密是根據kubernetes文檔創建的:

https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/

kubectl create secret generic harborcred \
    --from-file=.dockerconfigjson=~/.docker/config.json \
    --type=kubernetes.io/dockerconfigjson \
    --namespace=k8s-test7

任何幫助,將不勝感激!

嗨,你可以先看看:

  1. 更改圖像源並使用一些公共的fe nginx來驗證您的部署沒有其他問題。
  2. https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/還提供了有關檢查“秘密”的更多詳細信息。
  3. 還請直接從您的節點執行與連接相關的其他測試,如本文[ 如何調試“ImagePullBackOff”中所述?

查找根本原因的其他步驟:




 1. Convert your secrets data:
kubectl get secret harborcred -n k8s-test7 --output="jsonpath={.data.\.dockerconfigjson}" | base64 --decode 2. Compare the result of decoding your "auth" field from the 1 step with your docker credentials using:
echo "your auth data" | base64 --decode 3. To find the root cause please use also: kubectl get events -n k8s-test7 | grep pull

請與您的日志分享。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM