<p dir="auto"><strong>Is this a request for help?</strong> (If yes, you should use our troubleshooting guide and community support channels, see <a href="http://kubernetes.io/docs/troubleshooting/" rel="nofollow">http://kubernetes.io/docs/troubleshooting/</a>.):<br>
No</p>
<p dir="auto"><strong>What keywords did you search in Kubernetes issues before filing this one?</strong> (If you have found any duplicates, you should instead reply there.):<br>
kubectl,defaultconfig</p>
<h2 dir="auto">Merge that possibly introduced the error: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="176768823" data-permission-text="Title is private" data-url="https://github.com/kubernetes/kubernetes/issues/32613" data-hovercard-type="pull_request" data-hovercard-url="/kubernetes/kubernetes/pull/32613/hovercard" href="https://github.com/kubernetes/kubernetes/pull/32613">#32613</a></h2>
<p dir="auto"><strong>Is this a BUG REPORT or FEATURE REQUEST?</strong> (choose one):<br>
Bug report</p>

<p dir="auto"><strong>Kubernetes version</strong> (use <code class="notranslate">kubectl version</code>): v1.4.0-beta.8<br>
<code class="notranslate">Client Version: version.Info{Major:"1", Minor:"4+", GitVersion:"v1.4.0-beta.8", GitCommit:"3040f87c570a772ce94349b379f41f329494a4f7", GitTreeState:"clean", BuildDate:"2016-09-19T07:54:34Z", GoVersion:"go1.7", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"4+", GitVersion:"v1.4.0-beta.8", GitCommit:"3040f87c570a772ce94349b379f41f329494a4f7", GitTreeState:"clean", BuildDate:"2016-09-19T07:54:34Z", GoVersion:"go1.7", Compiler:"gc", Platform:"linux/amd64"}</code></p>
<p dir="auto"><strong>Environment</strong>:</p>
<ul dir="auto">
<li><strong>Cloud provider or hardware configuration</strong>: virsh</li>
<li><strong>OS</strong> (e.g. from /etc/os-release): Debian GNU/Linux 8 (jessie)</li>
<li><strong>Kernel</strong> (e.g. <code class="notranslate">uname -a</code>): Linux 299e561bce9845aeb537a4a1a50a4562.dev.local-planet 3.10.0-327.el7.x86_64 <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="35192559" data-permission-text="Title is private" data-url="https://github.com/kubernetes/kubernetes/issues/1" data-hovercard-type="issue" data-hovercard-url="/kubernetes/kubernetes/issues/1/hovercard" href="https://github.com/kubernetes/kubernetes/issues/1">#1</a> SMP Thu Oct 29 17:29:29 EDT 2015 x86_64 GNU/Linux</li>
<li><strong>Install tools</strong>:</li>
<li><strong>Others</strong>:</li>
</ul>
<p dir="auto"><strong>What happened</strong>:<br>
kubectl w/o cluster configuration does not connect to apiserver with the following error: <code class="notranslate">The connection to the server localhost:8080 was refused - did you specify the right host or port?</code></p>
<p dir="auto"><strong>What you expected to happen</strong>:<br>
kubectl w/o parameters used to connect using in-cluster approach, using a token and <code class="notranslate">KUBERNETES_SERVICE_HOST</code> / <code class="notranslate">KUBERNETES_SERVICE_PORT</code> pair</p>
<p dir="auto"><strong>How to reproduce it</strong> (as minimally and precisely as possible):<br>
Install a cluster with <code class="notranslate">k8s 1.4-beta.8</code>, run a pod with <code class="notranslate">kubectl</code> and issue any command</p>
<p dir="auto"><strong>Anything else do we need to know</strong>:<br>
I think the problem is in this line:<br>
<a href="https://github.com/kubernetes/kubernetes/pull/32613/files#diff-47197a425491d7fcfa69115333533db9R116">https://github.com/kubernetes/kubernetes/pull/32613/files#diff-47197a425491d7fcfa69115333533db9R116</a></p>
<div class="highlight highlight-source-go notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="if IsConfigurationInvalid(defErr) &amp;&amp; !IsEmptyConfig(err) {"><pre class="notranslate"><span class="pl-k">if</span> <span class="pl-en">IsConfigurationInvalid</span>(<span class="pl-s1">defErr</span>) <span class="pl-c1">&amp;&amp;</span> <span class="pl-c1">!</span><span class="pl-en">IsEmptyConfig</span>(<span class="pl-s1">err</span>) {</pre></div>
<p dir="auto">where <code class="notranslate">err</code> (apparently) is always <code class="notranslate">nil</code>, and (I guess) should be the following instead:</p>
<div class="highlight highlight-source-go notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="if IsConfigurationInvalid(defErr) &amp;&amp; !IsEmptyConfig(defErr) {"><pre class="notranslate"><span class="pl-k">if</span> <span class="pl-en">IsConfigurationInvalid</span>(<span class="pl-s1">defErr</span>) <span class="pl-c1">&amp;&amp;</span> <span class="pl-c1">!</span><span class="pl-en">IsEmptyConfig</span>(<span class="pl-s1">defErr</span>) {</pre></div>
<p dir="auto">pod spec validation rejects env variable keys that contain dots (eg "FOO.BAR"), but "FOO.BAR" is a valid env variable name for some (though not all) shell environments, so this validation rule is overly strict.</p>
<p dir="auto"><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/smarterclayton/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/smarterclayton">@smarterclayton</a></p>