<p>I am new on Mac. I installed kubectl-cli by following the <a href="https://kubernetes.io/docs/tasks/tools/install-kubectl/" rel="nofollow noreferrer">instructions</a>
However, while checking the version via command: <code>kubectl version</code>, I am getting the following error:</p>

<pre><code>Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.1", GitCommit:"eec55b9ba98609a46fee712359c7b5b365bdd920", GitTreeState:"clean", BuildDate:"2018-12-13T19:44:19Z", GoVersion:"go1.11.2", Compiler:"gc", Platform:"darwin/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?
</code></pre>

<p>I did follow some <a href="https://stackoverflow.com/questions/51121136/the-connection-to-the-server-localhost8080-was-refused-did-you-specify-the-ri">questions</a> and found out that there exists no directory named <code>kubernetes</code> in <code>/etc/</code> folder.</p>

Aviral Srivastava
<p>The reason behind that is <code>kubectl version</code> prints Client Version and Server Version (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 <code>kubectl version</code> 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="nofollow noreferrer">minikube</a> to install cluster locally</p>
