Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Headlamp Fails to Connect to Kubernetes Clusters When Using Local DNS Resolver (dnsmasq) #2764

Open
ehsanhajian opened this issue Jan 21, 2025 · 2 comments
Labels
bug Something isn't working mac Issues related to Mac OS

Comments

@ehsanhajian
Copy link

Describe the bug

Headlamp cannot connect to any Kubernetes cluster (public or private) when using a local DNS resolver like dnsmasq. The connection attempts fail without any clear error messages in the UI, even though the clusters are accessible via other tools such as kubectl,openlens and dig.

Expected Outcome:
Headlamp should successfully connect to Kubernetes clusters (both public and private) when a local DNS resolver is used

To Reproduce

Steps to reproduce the bug:

Set up a local DNS resolver using dnsmasq with the following configuration:
Local private clusters mapped to IPs in dnsmasq.conf.
System configured to use 127.0.0.1 as the primary DNS resolver.
Open Headlamp.
Attempt to connect to a Kubernetes cluster (e.g., private cluster using privatelink DNS entries or public clusters).
Observe that Headlamp fails to establish a connection, even though kubectl works fine with the same kubeconfig.

Environment (please provide info about your environment):

Installation type: Mac (Homebrew)
Headlamp Version: Version 0.27.0 (0.27.0)
Other:
macOS version: 15.2
DNS setup: dnsmasq running on localhost (127.0.0.1) and configured to resolve private and public cluster domains.

Are you able to fix this issue?

No.

Additional Context

This issue occurs when dnsmasq is used as the primary DNS resolver. Without dnsmasq (using public DNS like 8.8.8.8), Headlamp works as expected.
Accessing clusters via kubectl works fine with the same kubeconfig, confirming that the issue is specific to Headlamp's DNS resolution behavior.
Regression: This might not be a regression, but earlier versions were not tested with local DNS setups.

@ehsanhajian ehsanhajian added the bug Something isn't working label Jan 21, 2025
@dosubot dosubot bot added the mac Issues related to Mac OS label Jan 21, 2025
@illume
Copy link
Collaborator

illume commented Jan 21, 2025

Hrmm.

I wonder if this has to do with the backend headlamp-server using the golang dns resolver instead of the libc one?

Are you able to build headlamp from source and try it? Set CGO_ENABLED=1

Or maybe leave some instructions on how to reproduce on a Mac with dnsmasq?

@ehsanhajian
Copy link
Author

Steps to Configure dnsmasq on macOS

brew install dnsmasq
sudo nano /usr/local/etc/dnsmasq.conf

Add you private cluster to dnsmasq config file. also set a public DNS for DNS forwarding.

server=8.8.8.8
# Kubernetes Private Link Entries
address=/cluster1.url/10.3.0.4
address=/cluster2.url/10.2.0.4

Restart dnsmasq service

sudo brew services start dnsmasq

Set local DNS service for your internet connection

Image

Run Headlamp and try to connect to public or private cluter.

Please let me know how I can compile it with above flag. I didn't find doc in git repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mac Issues related to Mac OS
Projects
Development

No branches or pull requests

2 participants