Abhishek Ghosh
Abhishek Ghosh

Reputation: 675

Pods unable to connect to connect to internet when using Minikube with --driver=none option

For some specific use cases, I want to start Minikube with the --driver=none option.

$ sudo minikube start --driver=none 
๐Ÿ˜„  minikube v1.31.2 on Ubuntu 22.04
โœจ  Using the none driver based on user configuration
๐Ÿ‘  Starting control plane node minikube in cluster minikube
๐Ÿคน  Running on localhost (CPUs=12, Memory=64249MB, Disk=233348MB) ...
โ„น  OS release is Ubuntu 22.04.3 LTS
๐Ÿณ  Preparing Kubernetes v1.27.4 on Docker 24.0.5 ...
    โ–ช kubelet.resolv-conf=/run/systemd/resolve/resolv.conf
    โ–ช Generating certificates and keys ...
    โ–ช Booting up control plane ...
    โ–ช Configuring RBAC rules ...
๐Ÿ”—  Configuring bridge CNI (Container Networking Interface) ...
๐Ÿคน  Configuring local host environment ...

โ—  The 'none' driver is designed for experts who need to integrate with an existing VM
๐Ÿ’ก  Most users should use the newer 'docker' driver instead, which does not require root!
๐Ÿ“˜  For more information, see: https://minikube.sigs.k8s.io/docs/reference/drivers/none/

โ—  kubectl and minikube configuration will be stored in /root
โ—  To use kubectl or minikube commands as your own user, you may need to relocate them. For example, to overwrite your own settings, run:

    โ–ช sudo mv /root/.kube /root/.minikube $HOME
    โ–ช sudo chown -R $USER $HOME/.kube $HOME/.minikube

๐Ÿ’ก  This can also be done automatically by setting the env var CHANGE_MINIKUBE_NONE_USER=true
๐Ÿ”Ž  Verifying Kubernetes components...
    โ–ช Using image gcr.io/k8s-minikube/storage-provisioner:v5
๐ŸŒŸ  Enabled addons: default-storageclass, storage-provisioner

โ—  /usr/local/bin/kubectl is version 1.24.2, which may have incompatibilities with Kubernetes 1.27.4.
    โ–ช Want kubectl v1.27.4? Try 'minikube kubectl -- get pods -A'
๐Ÿ„  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

All the pods are running fine:

$ sudo kubectl get pods --all-namespaces
NAMESPACE     NAME                               READY   STATUS    RESTARTS   AGE
default       ubuntu-pod                         1/1     Running   0          3m42s
kube-system   coredns-5d78c9869d-kf8h6           1/1     Running   0          5m55s
kube-system   etcd-abhishek                      1/1     Running   2          6m7s
kube-system   kube-apiserver-abhishek            1/1     Running   2          6m11s
kube-system   kube-controller-manager-abhishek   1/1     Running   2          6m8s
kube-system   kube-proxy-b4dn8                   1/1     Running   0          5m55s
kube-system   kube-scheduler-abhishek            1/1     Running   2          6m7s
kube-system   storage-provisioner                1/1     Running   0          6m7s

Then I wrote a simple ubuntu-pod to check internet access

ubuntu-pod.yml:

apiVersion: v1                                                                                                                                                                                 
kind: Pod                                                                                                                                                                                      
metadata:                                                                                                                                                                                      
  name: ubuntu-pod                                                                                                                                                                             
spec:                                                                                                                                                                                          
  containers:                                                                                                                                                                                  
  - name: ubuntu-container                                                                                                                                                                     
    image: ubuntu:latest
    command:
      - "sleep"
      - "3600"
    stdin: true
    tty: true

Then I try to launch the terminal of that pod and try to check internet connectivity:

$ sudo kubectl exec -it ubuntu-pod -- /bin/bash
root@ubuntu-pod:/# apt update
Ign:1 http://security.ubuntu.com/ubuntu jammy-security InRelease         
Ign:2 http://archive.ubuntu.com/ubuntu jammy InRelease                   
Ign:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease           
Ign:1 http://security.ubuntu.com/ubuntu jammy-security InRelease         
Ign:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease         
Ign:1 http://security.ubuntu.com/ubuntu jammy-security InRelease         
Ign:2 http://archive.ubuntu.com/ubuntu jammy InRelease                   
Err:1 http://security.ubuntu.com/ubuntu jammy-security InRelease         
  Temporary failure resolving 'security.ubuntu.com'
Ign:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease           
Ign:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Ign:2 http://archive.ubuntu.com/ubuntu jammy InRelease
Ign:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Ign:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Err:2 http://archive.ubuntu.com/ubuntu jammy InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Reading package lists... Done        
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
root@ubuntu-pod:/# 

I understand when I use the driver=none in minikube, it makes use of the host system. Is the issue in DNS resolution due to the host machine? I am not sure. But the internet works fine on my host machine.

When I remove the --driver=option and do $ minikube start and follow the above steps, the pods connects to internet just fine.

Attach the log file

log.txt Please consider the last start...

Operating System

Ubuntu

Driver

None

Upvotes: 1

Views: 202

Answers (0)

Related Questions