<p>After creating a GKE cluster using POST to the below api endpoint</p>
<pre><code>https://container.googleapis.com/v1beta1/projects/&lt;project name&gt;/zones/&lt;zone&gt;/clusters
</code></pre>
<p>I wanted to access the cluster and run kubectl commands using Ansible. For this however i would need kubeconfig to be retrieved from the newly created cluster.</p>
<p>Any help would be appreciated.</p>

trial999
<p>There is no API call that generates the kubeconfig. Though if you are using the module to create the cluster, you should be defining the kubectl_path field. Make sure you are using the module from the <a href="https://github.com/ansible-collections/google.cloud" rel="nofollow noreferrer">google repo</a>. Otherwise, make sure you are authenticated with gcloud, and use the <code>command</code> module to run <code>gcloud container get-credentials</code> to fetch the config. You should be able to use the k8s module from that point on</p>
