<p>I'm beginning to build out a kubernetes cluster for our applications. We are using Azure for cloud services, so my K8s cluster is built using AKS. The AKs cluster was created using the portal interface for Azure. It has one node, and I am attempting to create a pod with a single container to deploy to the node. Where I am stuck currently is trying to connect to the AKS cluster from Powershell.
The steps I have taken are:</p>
<pre><code>az login (followed by logging in)
az account set --subscription &lt;subscription id&gt;
az aks get-credentials --name &lt;cluster name&gt; --resource-group &lt;resource group name&gt;
kubectl get nodes
</code></pre>
<p>After entering the last line, I am left with the error: Unable to connect to the server: dial tcp: lookup : no such host</p>
<p>I've also gone down a few other rabbit holes found on SO and other forums, but quite honestly, I'm looking for a straight forward way to access my cluster before complicating it further.</p>
<p>Edit: So in the end, I deleted the resource I was working with and spun up a new version of AKS, and am now having no trouble connecting. Thanks for the suggestions though!</p>

Carson
<p>As of now, the aks run command adds a <a href="https://learn.microsoft.com/en-gb/azure/aks/private-clusters#options-for-connecting-to-the-private-cluster" rel="nofollow noreferrer">fourth option</a> to connect to private clusters extending <a href="https://stackoverflow.com/users/7001697/darius">@Darius</a>'s <a href="https://stackoverflow.com/a/66002325">three options</a> posted earlier:</p>
<blockquote>
<ol start="4">
<li>Use the <a href="https://learn.microsoft.com/en-gb/azure/aks/command-invoke" rel="nofollow noreferrer">AKS Run Command feature</a>.</li>
</ol>
</blockquote>
<p>Below are some copy/paste excerpts of a simple command, and one that requires a file. It is possible to chain multiple commands with <code>&amp;&amp;</code>.</p>
<pre class="lang-bash prettyprint-override"><code>az aks command invoke \
  --resource-group myResourceGroup \
  --name myAKSCluster \
  --command &quot;kubectl get pods -n kube-system&quot;

az aks command invoke \
  --resource-group myResourceGroup \
  --name myAKSCluster \
  --command &quot;kubectl apply -f deployment.yaml -n default&quot; \
  --file deployment.yaml
</code></pre>
<p>In case you get a <code>(ResourceGroupNotFound)</code> error, try adding the subscription, too</p>
<pre class="lang-bash prettyprint-override"><code>az aks command invoke \
  --resource-group myResourceGroup \
  --name myAKSCluster \
  --subscription &lt;subscription&gt; \
  --command &quot;kubectl get pods -n kube-system&quot;
</code></pre>
<p>You can also configure the default subscription:</p>
<pre class="lang-bash prettyprint-override"><code>az account set -s &lt;subscription&gt;
</code></pre>
