<p>I just finished installing <code>kubectl</code> via <code>Ubuntu 64 (Linux)</code>. 
I followed the online Kubernetes guide, but I've had an error with the host. After the first step (install kubectl), when I checked the kubectl version, this was the message (I didn't yet install and deploy the minikube because I've not the connection according to this problem):</p>

<pre><code>root@ubuntu:~# kubectl version
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.1", GitCommit:"eec55b9ba98609a46fee712359c7b5b365bdd920", GitTreeState:"clean", BuildDate:"2018-12-13T10:39:04Z", GoVersion:"go1.11.2", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?
</code></pre>

<p>Does someone have the same problem? How can I fix it?</p>

<p>The reason behind that is <code>kubectl version</code> prints <code>Client Version</code> and <code>Server Version</code> (kubernetes version) both. When you just install kubectl it is just Kubernetes client. If you have kubernetes cluster installed, it will print both kubectl version and kubernetes version.</p>
<p>If you want to just want to print client version, then use following command:</p>
<pre><code>kubectl version --client=true
</code></pre>
<p>The error meant <code>kubectl tried to contact the kubernetes server to get its version but couldn't connect. Are you specifying the right host or port to connect to the kubernetes server.</code></p>
<p>The reason behind the error is you have not installed kubernetes cluster on you mac. You just installed kubectl which is just a client to access kubernetes cluster. Once you install the kubernetes cluster the output of kubectl version will be like:</p>
<pre><code>[root@ip-10-0-1-138 centos]# kubectl version
Client Version: version.Info{Major:&quot;1&quot;, Minor:&quot;13&quot;, GitVersion:&quot;v1.13.1&quot;, 
GitCommit:&quot;eec55b9ba98609a46fee712359c7b5b365bdd920&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2018-12-13T10:39:04Z&quot;, GoVersion:&quot;go1.11.2&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}
Server Version: version.Info{Major:&quot;1&quot;, Minor:&quot;10&quot;, GitVersion:&quot;v1.10.3&quot;, GitCommit:&quot;2bba0127d85d5a46ab4b778548be28623b32d0b0&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2018-05-21T09:05:37Z&quot;, GoVersion:&quot;go1.9.3&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}
</code></pre>
<p>If you want to install the complete kubernetes cluster on mac, please try <a href="https://kubernetes.io/docs/setup/minikube/" rel="noreferrer">minikube</a> to install cluster locally.</p>
