簡體   English   中英

將圖像部署到 kube.netes pod 時出錯:“http: 服務器對 HTTPS 客戶端給出了 HTTP 響應”

[英]error deploying image to kubernetes pod: "http: server gave HTTP response to HTTPS client"

我有一個 kube.netes 節點,控制平面,它沒有被污染,可以將 pod 部署到。 我有一張 docker 圖像sdmay23-42.ece.iastate.edu:5000/canvas-lti-frontend:v2

我登錄了 docker cli。 daemon.json 設置了不安全的注冊表,我可以使用docker info進行驗證:

 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: sdmay2342
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  sdmay23-42.ece.iastate.edu:5000
  127.0.0.0/8
 Live Restore Enabled: false

我可以拉圖像:

Status: Image is up to date for sdmay23-42.ece.iastate.edu:5000/canvas-lti-frontend:v2
sdmay23-42.ece.iastate.edu:5000/canvas-lti-frontend:v2

我可以從圖像構建一個容器:

CONTAINER ID   IMAGE                                                    COMMAND                  CREATED         STATUS          PORTS                                       NAMES
ad582a4d514b   sdmay23-42.ece.iastate.edu:5000/canvas-lti-frontend:v2   "docker-entrypoint.s…"   6 seconds ago   Up 6 seconds    3000/tcp                                    test-frontend

當我將它部署到 yaml 清單中的節點時,出現錯誤。 基本清單:

apiVersion: v1
kind: Pod
metadata:
   name: test-pod
spec:
   containers:
   - name: test-container
     image: sdmay23-42.ece.iastate.edu:5000/canvas-lti-frontend:v2
     ports:
     - containerPort: 6379

命令: sudo kubectl create -f test-deploy.yaml響應: pod/test-pod created

pod的描述:

Name:             test-pod
Namespace:        default
Priority:         0
Service Account:  default
Node:             sdmay23-42/10.29.160.55
Start Time:       Sun, 27 Nov 2022 18:46:54 +0000
Labels:           <none>
Annotations:      <none>
Status:           Pending
IP:               10.244.0.116
IPs:
  IP:  10.244.0.116
Containers:
  test-container:
    Container ID:   
    Image:          sdmay23-42.ece.iastate.edu:5000/canvas-lti-frontend:v2
    Image ID:       
    Port:           6379/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       ImagePullBackOff
    Ready:          False
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-bvwzz (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  kube-api-access-bvwzz:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason     Age                From               Message
  ----     ------     ----               ----               -------
  Normal   Scheduled  51s                default-scheduler  Successfully assigned default/test-pod to sdmay23-42
  Normal   BackOff    23s (x2 over 50s)  kubelet            Back-off pulling image "sdmay23-42.ece.iastate.edu:5000/canvas-lti-frontend:v2"
  Warning  Failed     23s (x2 over 50s)  kubelet            Error: ImagePullBackOff
  Normal   Pulling    12s (x3 over 50s)  kubelet            Pulling image "sdmay23-42.ece.iastate.edu:5000/canvas-lti-frontend:v2"
  Warning  Failed     12s (x3 over 50s)  kubelet            Failed to pull image "sdmay23-42.ece.iastate.edu:5000/canvas-lti-frontend:v2": rpc error: code = Unknown desc = failed to pull and unpack image "sdmay23-42.ece.iastate.edu:5000/canvas-lti-frontend:v2": failed to resolve reference "sdmay23-42.ece.iastate.edu:5000/canvas-lti-frontend:v2": failed to do request: Head "https://sdmay23-42.ece.iastate.edu:5000/v2/canvas-lti-frontend/manifests/v2": http: server gave HTTP response to HTTPS client
  Warning  Failed     12s (x3 over 50s)  kubelet            Error: ErrImagePull

解決方案是配置 containerd 以接受不安全的注冊表。 我以為 kube.netes 使用的是 docker。你可以執行kubectl get nodes -o wide來查看有關容器運行時的信息。

在此處配置 containrd 的步驟: How to pull docker image from a insecure private registry with latest Kube.netes

暫無
暫無

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

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