I had an Ubuntu 20.04 server which was used for CI/CD and it was using Docker on it to build and publish images.
The resources were not that much requested so I decided to install Kubernetes on that server to add a second master node to my k8s cluster.
Therefore I ran kubespray
on it as a Master node and the installation completed successfully. Since the install of k8s I get a strange issue.
Using the command line kubectl exec -it podname -- sh
I can do a nslookup google.com
and it works fine.
Server: 192.168.1.1
Address: 192.168.1.1:53
Non-authoritative answer:
Name: google.com
Address: 2607:f8b0:4020:805::200e
Non-authoritative answer:
Name: google.com
Address: 172.217.13.142
Once I used the docker exec -it ubuntu bash
command line I cannot resolve any dns entry once in a pure docker container not using kubernetes layer.
The docker daemon uses the kubernetes dns to resolve. In the file /etc/systemd/system/docker.service.d/docker-dns.conf
it is setup as
Environment="DOCKER_DNS_OPTIONS=\
--dns 10.233.0.3 --dns 127.0.0.53 \
--dns-search default.svc.cluster.local --dns-search svc.cluster.local --dns-search lan \
--dns-opt ndots:2 --dns-opt timeout:2 --dns-opt attempts:2"
Is it possible to run pure docker container on a k8s node?
Update
After a while passed at debugging I figured out it is not the a DNS issue but rather the entire traffic not able to get outside the docker network.
I figured this out when I tried to use apt update
and I could see it was able to resolve the repository address but in no way it was able to reach the mirror.
Until I have more time I will just host another cicd server and not mixed k8s node with anything else.