<p>I'm creating a pipeline to deploy some application in kubernetes.</p>
<p>I've been given the authentication credentials as a yaml file similar to the following:</p>
<pre><code>apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0tL******0tLS0t
    server: https://api.whatever.com
  name: gs-name-clientcert
contexts:
- context:
    cluster: gs-name-clientcert
    user: gs-name-clientcert-user
  name: gs-name-clientcert
current-context: gs-name-clientcert
kind: Config
preferences: {}
users:
- name: gs-name-clientcert-user
  user:
    client-certificate-data: LS************RS0tLS0t
    client-key-data: LS0tL***********tLQ==
</code></pre>
<p>How can I tell kubectl to use that config file when I use the apply command?
Thanks.</p>

DeejonZ
<p><strong>kubeconfig file path:</strong></p>
<p>The config modifies kubeconfig files using subcommands like “kubectl config set current-context my-context”
The loading order follows these rules:</p>
<ol>
<li><p>If the –kubeconfig flag is set, then only that file is loaded. The flag may only be set once and no merging takes place.</p>
</li>
<li><p>If the $KUBECONFIG environment variable is set, then it uses a list of paths (normal path delimiting rules for your system). These paths are merged together. When a value is modified, it is modified in the file that defines the stanza. When a value is created, it is created in the first file that exists. If no files in the chain exist, it creates the last file in the list.</p>
</li>
<li><p>Otherwise, ${HOME}/.kube/config is used and no merging takes place.</p>
<p>kubectl config SUBCOMMAND</p>
<p>Options</p>
<p>--kubeconfig=&quot;&quot;: use a particular kubeconfig file</p>
</li>
</ol>
<p>For more information refer to the command <a href="https://jamesdefabia.github.io/docs/user-guide/kubectl/kubectl_config/" rel="nofollow noreferrer">kubectl config</a> and also follow the path <a href="https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/" rel="nofollow noreferrer">config file</a>.</p>
<p><strong>Also check the indentation of your config file:</strong></p>
<ul>
<li><p>If you are using TAB for indentation or any other purpose. Only use SPACE characters.</p>
</li>
<li><p>To find indentation errors use monospaced fonts to view and edit YAML.</p>
</li>
</ul>
<p>For more information about indentation refer to <a href="https://www.tutorialspoint.com/yaml/yaml_indentation_and_separation.htm#:%7E:text=YAML%20in%20detail.-,Indentation%20of%20YAML,-YAML%20does%20not" rel="nofollow noreferrer">Indentation to YAML</a></p>
