Skip to content

Instantly share code, notes, and snippets.

@mickaelandrieu
Created January 1, 2025 23:45
Show Gist options
  • Save mickaelandrieu/449141bd849fc3cb4a27c88548cb9382 to your computer and use it in GitHub Desktop.
Save mickaelandrieu/449141bd849fc3cb4a27c88548cb9382 to your computer and use it in GitHub Desktop.

How to Fix UnknownHostException: connectors.airbyte.com in Airbyte Server Pod

This guide provides a structured solution to resolve java.net.UnknownHostException: connectors.airbyte.com, which occurs when Airbyte fails to resolve DNS for external services. The primary goal is to ensure proper DNS resolution by configuring CoreDNS to use reliable external DNS servers.


1. Map abctl to kubectl

Why?

abctl is a wrapper tool for managing Airbyte deployments but internally uses Kubernetes. To diagnose and fix DNS issues effectively, we need direct access to Kubernetes commands (kubectl).

What to do?

  1. Identify the kubeconfig file used by abctl:

    abctl local deployments

    Note the Kubeconfig file path, e.g., /home/ubuntu/.airbyte/abctl/abctl.kubeconfig.

  2. Set the KUBECONFIG environment variable so that kubectl uses the same configuration:

    export KUBECONFIG=/home/ubuntu/.airbyte/abctl/abctl.kubeconfig
  3. Confirm the Kubernetes context is correct:

    kubectl config current-context
  4. Test access by listing pods in the Airbyte namespace:

    kubectl get pods -n airbyte-abctl

This ensures we are ready to use Kubernetes tools to address the DNS resolution issue.


2. Update CoreDNS to Use External DNS Servers (8.8.8.8, 8.8.4.4)

Why?

By default, CoreDNS forwards DNS requests to /etc/resolv.conf, which may rely on the internal DNS of the environment (e.g., a private cloud or restricted network). If this DNS setup fails to resolve external domains like connectors.airbyte.com, updating CoreDNS to use a reliable public DNS server (e.g., Google DNS) ensures proper resolution.

What to do?

  1. Edit the CoreDNS ConfigMap:

    kubectl edit configmap coredns -n kube-system
  2. Replace this configuration:

    forward . /etc/resolv.conf {
        max_concurrent 1000
    }

    With this:

    forward . 8.8.8.8 8.8.4.4 {
        max_concurrent 1000
    }

    Explanation: This change redirects DNS queries to Google Public DNS (8.8.8.8 and 8.8.4.4), which are highly reliable for resolving external domains.

  3. Save and exit the editor.

  4. Restart CoreDNS to apply the changes:

    kubectl rollout restart deployment coredns -n kube-system

This step ensures that any DNS query made by pods in your Kubernetes cluster is forwarded to reliable DNS servers.


3. Verify CoreDNS and Restart the Affected Airbyte Pod

Why?

Restarting the CoreDNS pods ensures that the updated configuration is active. Restarting the Airbyte Server API pod ensures it picks up the new DNS settings and retries DNS queries for external domains.

What to do?

  1. Confirm CoreDNS pods are running after the restart:

    kubectl get pods -n kube-system
  2. Restart the Airbyte Server API pod:

    kubectl delete pod <server-pod-name> -n airbyte-abctl

    Replace <server-pod-name> with the name of the Airbyte Server API pod, which you can find using:

    kubectl get pods -n airbyte-abctl
  3. Verify that Airbyte now resolves connectors.airbyte.com correctly. Check the pod logs for confirmation:

    kubectl logs <server-pod-name> -n airbyte-abctl

    You should no longer see the UnknownHostException error.


Outcome

After completing these steps, the Airbyte Server API should be able to resolve connectors.airbyte.com without issues, allowing it to fetch connector documentation and related resources. This fix ensures reliable DNS resolution across your Kubernetes cluster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment