0

System: VirtualBox, Debian 10 Server, Kubernetes with kubeadm

I've setup a deployment and a service and I am exposing it via NodePort but my Pods somehow cant access the internet. The worker node which runs the pod however has an internet connection. I tested this by exec into the running pod and curl a webpage.

Pods

root@master:/home/user# kubectl get pods
NAME                               READY   STATUS      RESTARTS   AGE
my-website-6d8f7c7bfb-sdtrh        1/1     Running     1          6d1h

Curl from Host

root@master:/home/user# curl https://wikipedia.org
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://www.wikipedia.org/">here</a>.</p>
</body></html>

Exec Pod - Curl

root@master:/home/user# kubectl exec -it my-website-6d8f7c7bfb-sdtrh /bin/bash
root@my-website-6d8f7c7bfb-sdtrh:/sbin# curl https://wikipedia.org
curl: (6) Could not resolve host: wikipedia.org

Anyone an idea what that could be? I'm fairly new to DevOps, so I don't know quite as much about all of that yet.

EDIT for Howard_Roark

  1. I've checked and yes the two /etc/resolv.conf's differ.

On worker node

root@worker:~# cat /etc/resolv.conf 
# Generated by NetworkManager
search fritz.box
nameserver 192.168.178.1

Inside Pod

/ # cat /etc/resolv.conf 
nameserver 10.96.0.10
search default.svc.cluster.local svc.cluster.local cluster.local fritz.box
options ndots:5
  1. From the node itself I can get out to another name server, but not from the pod.
root@worker:~# nslookup wikipedia.org 8.8.8.8
Server:     8.8.8.8
Address:    8.8.8.8#53

Non-authoritative answer:
Name:   wikipedia.org
Address: 91.198.174.192
Name:   wikipedia.org
Address: 2620:0:862:ed1a::1


root@worker:~# nslookup wikipedia.org 1.1.1.1
Server:     1.1.1.1
Address:    1.1.1.1#53

Non-authoritative answer:
Name:   wikipedia.org
Address: 91.198.174.192
Name:   wikipedia.org
Address: 2620:0:862:ed1a::1
  1. Is presumable gonna fail too hence 2. But I'll test it now.
9
  • Did you try restarting CoreDNS pod? – Matt Oct 14 '20 at 10:52
  • Are you using any network policies? – Matt Oct 14 '20 at 10:54
  • No network policies so far, do I need them? – JaySon Oct 14 '20 at 10:56
  • No, but if you had, configured incorrectly could block dns queries. – Matt Oct 14 '20 at 11:05
  • Does this happen only in this one container or every container? – Matt Oct 14 '20 at 11:06
1

Solution

The Problem disappeared after I moved to a proper development server. Apparently the Kubernetes cluster does not properly run with bridged AirPort network environments in Virutalbox.

2
  • 1
    Great that you were able to solve it, but please don't add Solved to the title of your question. Accept your answer when you can (usually after 2 days) and your question will be marked as solved by the system. – Gerald Schneider Oct 16 '20 at 7:06
  • Thanks Gerald. I've updated it. – JaySon Oct 16 '20 at 7:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.