Minikube can be a pain when your machine is behind a corporate proxy, but it’s not the network itself that’s the problem, it’s how Minikube’s internal components talk to each other and the outside world.

Let’s see Minikube’s Docker daemon, which is essentially running inside a VM, trying to pull an image:

# First, let's start minikube without any proxy config
minikube start --driver=docker

# Now, try to deploy something that needs an external image
kubectl create deployment nginx-test --image=nginx:latest

You’ll likely see ImagePullBackOff or ErrImagePull in kubectl get pods. This is because the Docker daemon inside Minikube’s VM can’t reach Docker Hub.

The core issue is that Minikube, by default, doesn’t know about your local machine’s proxy settings. The Docker daemon running within the Minikube virtual machine needs explicit instructions on how to route its HTTP and HTTPS traffic.

Here are the common culprits and how to fix them:

  1. Minikube VM’s Docker Daemon Proxy Settings: This is the most frequent offender. The Docker daemon inside the Minikube VM needs its proxy configured.

    • Diagnosis: SSH into the Minikube VM and check the Docker daemon’s configuration.
      minikube ssh
      # Inside the VM:
      sudo cat /etc/systemd/system/docker.service.d/http-proxy.conf
      
      If this file is missing or incorrect, that’s your problem.
    • Fix: You need to set environment variables for the Docker daemon. The easiest way is to tell minikube start to do this for you.
      # Replace with your actual proxy details
      export HTTP_PROXY="http://your_proxy_host:proxy_port"
      export HTTPS_PROXY="http://your_proxy_host:proxy_port"
      export NO_PROXY="localhost,127.0.0.1,10.96.0.0/12,192.168.0.0/16,192.168.49.0/24,192.168.64.0/24" # Add any other internal IPs/domains
      
      minikube delete # Clean up previous attempt
      minikube start --driver=docker --env HTTP_PROXY=$HTTP_PROXY --env HTTPS_PROXY=$HTTPS_PROXY --env NO_PROXY=$NO_PROXY
      
      This injects these variables into the Docker daemon’s systemd service.
    • Why it works: This configures the Docker daemon within the Minikube VM to use your specified proxy for pulling images and communicating with external registries. NO_PROXY is crucial for internal cluster communication.
  2. Kubernetes Node Proxy Settings: Even if Docker pulls images, Pods themselves might need proxy settings to reach external services.

    • Diagnosis: After Minikube starts with the Docker proxy configured, check if Pods can reach the internet.
      minikube start --driver=docker --env HTTP_PROXY=$HTTP_PROXY --env HTTPS_PROXY=$HTTPS_PROXY --env NO_PROXY=$NO_PROXY
      kubectl run net-check --image=busybox --command -- sleep 3600
      kubectl exec net-check -- wget -qO- http://example.com
      
      If this fails, the Kubernetes nodes (Minikube VM) need proxy settings.
    • Fix: You can configure the kubelet and kube-proxy to use proxy settings. This is often done by setting environment variables for the kubelet service on the Minikube VM.
      # Ensure minikube is running with the Docker proxy settings from step 1.
      # Then, update the kubelet service.
      minikube ssh
      # Inside the VM:
      sudo systemctl stop kubelet
      sudo mkdir -p /etc/systemd/system/kubelet.service.d
      sudo tee /etc/systemd/system/kubelet.service.d/http-proxy.conf <<EOF
      [Service]
      Environment="HTTP_PROXY=$HTTP_PROXY"
      Environment="HTTPS_PROXY=$HTTPS_PROXY"
      Environment="NO_PROXY=$NO_PROXY"
      EOF
      sudo systemctl daemon-reload
      sudo systemctl start kubelet
      exit
      
      Then restart your deployments or kubectl delete pod <pod-name> for them to be recreated on the updated node.
    • Why it works: This configures the kubelet process, which manages Pods on the node, to use the proxy for any outbound requests it makes on behalf of Pods that don’t have their own proxy settings.
  3. Docker Daemon Configuration File: Sometimes, the systemd override isn’t enough, or you need more granular control for the Docker daemon.

    • Diagnosis: Check the docker.service file directly for any conflicting or missing proxy directives.
      minikube ssh
      # Inside the VM:
      sudo cat /lib/systemd/system/docker.service
      
      Look for Environment= lines or ExecStart= that might override settings.
    • Fix: Manually create or edit the http-proxy.conf file within the docker.service.d directory.
      minikube ssh
      # Inside the VM:
      sudo tee /etc/systemd/system/docker.service.d/http-proxy.conf <<EOF
      [Service]
      Environment="HTTP_PROXY=$HTTP_PROXY"
      Environment="HTTPS_PROXY=$HTTPS_PROXY"
      Environment="NO_PROXY=$NO_PROXY"
      EOF
      sudo systemctl daemon-reload
      sudo systemctl restart docker
      exit
      
    • Why it works: This ensures the Docker daemon is explicitly launched with the correct proxy environment variables, overriding any defaults or inherited settings.
  4. Pod-level Proxy Configuration: For specific applications running inside Pods that need to respect proxy settings, you can set environment variables directly in your Deployment or Pod definition.

    • Diagnosis: An application within a Pod fails to reach an external API.
    • Fix: Add environment variables to your Pod spec.
      apiVersion: v1
      kind: Pod
      metadata:
        name: my-app-with-proxy
      spec:
        containers:
        - name: my-app
          image: my-app-image
          env:
          - name: HTTP_PROXY
            value: "http://your_proxy_host:proxy_port"
          - name: HTTPS_PROXY
            value: "http://your_proxy_host:proxy_port"
          - name: NO_PROXY
            value: "localhost,127.0.0.1,10.96.0.0/12,192.168.0.0/16,192.168.49.0/24,192.168.64.0/24"
      
    • Why it works: Many applications are written to automatically pick up HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables for their outbound requests.
  5. Client-side kubectl Proxy: While less common for Minikube itself, your local kubectl command might need proxy settings if it needs to communicate through a proxy to reach the Kubernetes API server (though Minikube usually binds it locally).

    • Diagnosis: kubectl commands fail with connection refused or timeouts even though Minikube is running.
    • Fix: Set proxy environment variables in your local shell before running kubectl.
      export HTTP_PROXY="http://your_proxy_host:proxy_port"
      export HTTPS_PROXY="http://your_proxy_host:proxy_port"
      export NO_PROXY="localhost,127.0.0.1,$(minikube ip)" # Add minikube IP
      
    • Why it works: This ensures your local kubectl client can reach the Minikube API server if it’s exposed through a proxy. For Minikube, this is usually only relevant if you’re tunneling or have a very unusual setup.
  6. Git Proxy Settings (if building images within Minikube): If your build process involves git clone operations within a Docker build, Git itself needs to know about the proxy.

    • Diagnosis: docker build commands fail with Git clone errors.
    • Fix: Configure Git within the Minikube VM.
      minikube ssh
      # Inside the VM:
      git config --global http.proxy "$HTTP_PROXY"
      git config --global https.proxy "$HTTPS_PROXY"
      # You might also need to configure Git's proxy for specific repos or globally for credentials.
      exit
      
    • Why it works: This tells the Git client, which is executed during a docker build step, how to connect to remote repositories.

After applying the correct proxy settings, you’ll likely encounter issues with DNS resolution within Pods if your NO_PROXY list is too restrictive or your proxy server doesn’t handle internal DNS requests properly.

Want structured learning?

Take the full Minikube course →