<p>I created new <code>config</code> file for Kubernetes from <code>Azure</code> in <code>Powershell</code> by <code>az aks get-credentials --resource-group &lt;RGName&gt; --name &lt;ClusterName&gt;</code>. Got a message that <code>Merged &quot;cluster_name&quot; as current context in C:\michu\.kube\config</code>. I copied this file into default <code>.kube\config</code> location and now when I try to run any command e.g <code>kubectl get pods</code> I am receiving:</p>
<pre><code>Unable to connect to the server: getting credentials: exec: executable kubelogin not found

It looks like you are trying to use a client-go credential plugin that is not installed.

To learn more about this feature, consult the documentation available at:
      https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins
</code></pre>
<p>What is wrong here?</p>
<p>I just realized that when I type <code>kubectl config get-contexts</code> then I can see my <code>cluster_name</code> and I can even switch to this by <code>kubectl config use-context cluster_name</code> and message is correct: <code>Switched to context cluster_name</code> but then still all other commands ends with <code>Unable to connect to the server: getting credentilas: exec: executable kubelogin not found</code></p>

Michu93
<p>The error implies that the <code>kubelogin</code> executable could not be located. You need to install <code>kubelogin</code> in the azure cli using
<code>az aks install-cli</code>, then it works as expected.</p>
<p>Refer <a href="https://azure.github.io/kubelogin/install.html" rel="nofollow noreferrer">github</a> for installation process.</p>
<p><em>I tried the same requirement in my environment, and it worked for me as follows.</em></p>
<pre class="lang-bash prettyprint-override"><code>az aks get-credentials --resource-group caroline --name sampleaks1
kubectl get pods
</code></pre>
<p><em><strong>Output:</strong></em></p>
<p><img src="https://i.stack.imgur.com/ToC95.png" alt="enter image description here" /></p>
<p>Once you have the <code>aks</code> credentials, running <code>kubectl get pods</code> will prompt you for an <code>Azure kubernetes service authentication with AAD</code>, as shown.</p>
<p><img src="https://i.stack.imgur.com/IDoCf.png" alt="enter image description here" /></p>
<p><em>Just give</em> <code>kubectl</code> <em>in the bash</em> <em>to verify whether it is installed successfully.</em></p>
<p><img src="https://i.stack.imgur.com/U7ve2.png" alt="enter image description here" /></p>
<p><em>If still the issue persists,</em></p>
<ol>
<li><p>Delete all the cache or any unused folders inside the ~/.kube/ and ran the aks credentials command by adding
<code>--admin</code> flag in the end.</p>
<p>Refer this <a href="https://blog.baeke.info/2021/06/03/a-quick-look-at-azure-kubelogin/" rel="nofollow noreferrer">doc</a> by @Geert Baeke for more related information.</p>
</li>
<li><p>Check the kube config version and upgrade if required.</p>
</li>
</ol>
