<p>I am trying to connect terraform to a Kubernetes cluster, but the documentation on Terraform is not clear on which client certificates I should use for TLS connection. Since I am new to both Kubernetes and Terraform, I could not figure that out:</p>
<pre><code>provider &quot;kubernetes&quot; {
  host = &quot;https://xxx.xxx.xxx.xxx&quot;

  client_certificate     = &quot;${file(&quot;~/.kube/client-cert.pem&quot;)}&quot;
  client_key             = &quot;${file(&quot;~/.kube/client-key.pem&quot;)}&quot;
  cluster_ca_certificate = &quot;${file(&quot;~/.kube/cluster-ca-cert.pem&quot;)}&quot;
}
</code></pre>
<p>in the /etc/kubernetes/pki there is more than one certificate and key ( front-proxy-client, api-server-client, api-server-kubelet-client ), which one should I use to Allow terraform to connect to my cluster ?</p>
<hr />
<p><strong>Edit:</strong> Here is the kubernetes version ( output of kubectl version )</p>
<pre><code>Client Version: version.Info{Major:&quot;1&quot;, Minor:&quot;22&quot;, GitVersion:&quot;v1.22.1&quot;, GitCommit:&quot;632ed300f2c34f6d6d15ca4cef3d3c7073412212&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2021-08-19T15:45:37Z&quot;, GoVersion:&quot;go1.16.7&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}
Server Version: version.Info{Major:&quot;1&quot;, Minor:&quot;22&quot;, GitVersion:&quot;v1.22.3&quot;, GitCommit:&quot;c92036820499fedefec0f847e2054d824aea6cd1&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2021-10-27T18:35:25Z&quot;, GoVersion:&quot;go1.16.9&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}
</code></pre>

joe1531
<p>I found out the reason. It was not connected to Terraform. The problem is when I setup my cluster I used the option --apiserver-advertise-address=&lt;MASTER_NODE_PRIVATE_IP&gt; in the kubeadm init command, but when I used --control-plane-endpoint=&lt;MASTER_NODE_PUBLIC_IP&gt;, it worked.</p>
