嘗試從 AWS ECR 擷取映像時,Kubernetes Pod 會因 ImagePullBackOff 而失敗

嘗試從 AWS ECR 擷取映像時,Kubernetes Pod 會因 ImagePullBackOff 而失敗

我正在嘗試使用 Docker-Desktop 在我的 Windows 電腦中執行一些 Kubernetes pod。我正在嘗試使用 HELM 安裝它們。我已經建立了 Docker 映像並將它們推送到 AWS ECR 私人儲存庫。

當我嘗試執行 HELM install 命令來啟動容器時,它們就會被建立。然而,當他們嘗試從 AWS ECR 中提取映像時,它會拋出錯誤,容器會收到“影像拉回關閉' 錯誤。

描述失敗的 pod 時的錯誤:

無法拉取映像「012345678900.dkr.ecr.ap-south-1.amazonaws.com/arjun-poc1/centos-test1:latest」:rpc 錯誤:程式碼= 未知desc = 來自守護程式的錯誤回應:頭「https :// /012345678900.dkr.ecr.ap-south-1.amazonaws.com/v2/arjun-poc1/centos-test1/manifests/latest」:沒有基本驗證憑證

我已經做到了'AWS配置' 踏出並運行 'aws ecr 取得登入密碼' 命令。我可以手動運行“docker pull”並在本地獲取映像。但是,它不會在容器啟動期間自動拉取。

我也嘗試過設定一個 '圖像拉取秘密' 透過執行以下命令:.也嘗試將其包含在values.yaml 中。kubectl create secret docker-registry aws-secret --docker-server=https://[email protected] --docker-username=AWS --docker-password=$(aws ecr get-login-password)

圖表\centos-test1\templates\deployment.yaml

spec:
  imagePullSecrets: {{- toYaml .Values.global.imagePullSecrets | nindent 12 }}

值.yaml

global:
  hub: 012345678900.dkr.ecr.ap-south-1.amazonaws.com/arjun-poc1
  imagePullSecrets:
  - name: aws-secret


  images:
    centos-test1:
        name: centos-test1
        tag: latest
        pullPolicy: Always

但它仍然不起作用。我每次都會收到“ImagePullBackOff”錯誤。有誰知道如何解決這個問題?

相關內容