You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Minikube/K8S环境下通过YAML部署本地Docker仓库镜像时遭遇ImagePullBackOff错误的求助

Fixing ImagePullBackOff: HTTP Response to HTTPS Client in Minikube

The core issue here is that Minikube runs its own isolated Docker daemon inside its virtual machine, so the insecure-registry config you added to your host's /etc/docker/daemon.json doesn't apply to Minikube's internal Docker. Minikube is trying to pull your image over HTTPS, but your local registry only serves HTTP—hence the error.

Here are the most reliable fixes:

1. Configure Minikube's Docker Daemon Directly

This is the standard approach for permanent configuration:

  • SSH into the Minikube VM:
    minikube ssh
    
  • Create or edit the Docker daemon config file inside the VM:
    sudo nano /etc/docker/daemon.json
    
  • Add your insecure registry entry (replace 192.168.xx.yy:5000 with your actual registry address):
    {
      "insecure-registries": ["192.168.xx.yy:5000"]
    }
    
  • Restart Docker inside the VM to apply changes:
    sudo systemctl restart docker
    
  • Exit the VM and restart Minikube to ensure all components pick up the new config:
    exit
    minikube stop && minikube start
    

2. Start Minikube with Insecure Registry Flag

If you prefer a one-time setup (or want to test quickly), pass the registry directly when starting Minikube:

  • First stop any running Minikube instance:
    minikube stop
    
  • Start Minikube with the insecure registry parameter:
    minikube start --insecure-registry=192.168.xx.yy:5000
    

3. Use Minikube's Built-in Registry (Alternative Approach)

If you want to avoid managing a separate local registry, Minikube has a built-in registry addon:

  • Enable the registry addon:
    minikube addons enable registry
    
  • Set up port forwarding from your host to the Minikube registry so you can push images to it:
    kubectl port-forward --namespace kube-system service/registry 5000:5000
    
  • Tag your local image for the Minikube registry and push it:
    docker tag test-api-rest:1.0 localhost:5000/test-api-rest:1.0
    docker push localhost:5000/test-api-rest:1.0
    
  • Update your Deployment YAML's image field to localhost:5000/test-api-rest:1.0, then re-apply the file:
    kubectl apply -f test-api-rest-all.yaml
    

Quick Checks to Verify

  • After configuring, test if Minikube can reach your registry: SSH into the VM and run curl http://192.168.xx.yy:5000/v2/—you should get an empty JSON response {} if it's working.
  • Double-check your Deployment's imagePullPolicy: If you know the image is already on the Minikube node, you can set it to IfNotPresent or Never, but fixing the insecure registry config will make Always work as expected too.

内容的提问来源于stack exchange,提问作者srigu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.30 16:27:52