<p dir="auto">I have a feeling this is more related to Go than kubernetes specifically but the <code class="notranslate">CGO_ENABLED=0</code> builds cause this problem to occur.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="➜  amd64 ./kubectl get po
Unable to connect to the server: dial tcp: lookup kube-apiserver01.internal: no such host"><pre class="notranslate"><code class="notranslate">➜  amd64 ./kubectl get po
Unable to connect to the server: dial tcp: lookup kube-apiserver01.internal: no such host
</code></pre></div>
<p dir="auto">When rebuilding off the v1.2.0 tag with <code class="notranslate">CGO_ENABLED=1</code> in the <code class="notranslate">hack/lib/golang.sh</code> DNS works as expected:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="➜  kubernetes git:(5cb86ee) ./_output/local/bin/darwin/amd64/kubectl get po
NAME                            READY     STATUS    RESTARTS   AGE
pod123   3/3       Running   0          19h"><pre class="notranslate"><code class="notranslate">➜  kubernetes git:(5cb86ee) ./_output/local/bin/darwin/amd64/kubectl get po
NAME                            READY     STATUS    RESTARTS   AGE
pod123   3/3       Running   0          19h
</code></pre></div>
<p dir="auto">You can also reproduce that the go dns implementation is lacking with the <code class="notranslate">CGO_ENABLED=1</code> bin via env variables:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="➜  kubernetes git:(5cb86ee) GODEBUG=netdns=go ./_output/local/bin/darwin/amd64/kubectl get po
Unable to connect to the server: dial tcp: lookup kube-apiserver01.internal on 8.8.8.8:53: no such host"><pre class="notranslate"><code class="notranslate">➜  kubernetes git:(5cb86ee) GODEBUG=netdns=go ./_output/local/bin/darwin/amd64/kubectl get po
Unable to connect to the server: dial tcp: lookup kube-apiserver01.internal on 8.8.8.8:53: no such host
</code></pre></div>
<p dir="auto">As expected, it isn't an option to force cgo resolution via runtime env variables for the <code class="notranslate">CGO_ENABLED=0</code> bin:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="➜  amd64 GODEBUG=netdns=cgo ./kubectl get po
Unable to connect to the server: dial tcp: lookup prod-kube-apiserver01.nyc3.internal.digitalocean.com: no such host"><pre class="notranslate"><code class="notranslate">➜  amd64 GODEBUG=netdns=cgo ./kubectl get po
Unable to connect to the server: dial tcp: lookup prod-kube-apiserver01.nyc3.internal.digitalocean.com: no such host
</code></pre></div>
<p dir="auto">cgo is required for certain go std libraries to work.  See <a href="https://inconshreveable.com/04-30-2014/cross-compiling-golang-programs-with-native-libraries/" rel="nofollow">this</a> article for details.</p>
<p dir="auto">This breaks kubectl name resolution for some cases.  See <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="249123886" data-permission-text="Title is private" data-url="https://github.com/kubernetes/kubectl/issues/48" data-hovercard-type="issue" data-hovercard-url="/kubernetes/kubectl/issues/48/hovercard" href="https://github.com/kubernetes/kubectl/issues/48">kubernetes/kubectl#48</a> for details.</p>