Retrieve KubeConfig from Clusters

How to retrieve the kubeconfig YAML file from clusters using Frontier CLI

To perform tasks within the frontier CLI application, you are required to authenticate using your organization’s OIDC provider. Refer to the Authentication using Frontier CLI guide if you need assistance on logging in for use of Frontier services.

Frontier users and administrators may want to retrieve existing information within their organization’s management cluster.

Cluster’s KubeConfig Retrieval Guide

Frontier users and administrators may want the kubeconfig to their clusters to perform tasks needed for their projects and organization. This guide will cover a step-by-step tutorial on how the user can retrieve the kubeconfig file to their clusters.

To begin retrieving your cluster’s kubeconfig file, we will start off by navigating to this feature. When you run frontier, you should see a list of capabilites using Frontier-CLI.

Frontier CLI Main Menu

You can see all the actions you are able to perform within your Frontier-CLI menu options. We will run frontier get to see the information retrieval options within the interface.

Frontier CLI Get Menu

All Frontier administrative roles will be able to retrieve information on workload cluster’s kubeconfig using the get action. However, this is restricted for cluster administrators, as they would have to be the original creator for that specific workload cluster they desire the kubeconfig of. We can use -h flag to bring up the help menu. To see the help menu for options on how you would like to get your cluster’s kubeconfig file, run the following command below:

frontier get kubeconfig -h

Expected output:

Frontier CLI Get Kubeconfig Help

Retrieve Detailed Information on a Specific Cluster

When you ran the help command earlier for getting the kubeconfig of clusters, you will find a required flag --project-name or -n for the project the cluster is residing in. Therefore, the template of running the command to retrieve the kubeconfig is:

frontier get kubeconfig <cluster-name> -n <project-name>

For this example, we will retrieve the kubeconfig file from the cluster azure-frontier-k3s created from the cluster creation tutorial guide. This cluster resides in the frontier-test project.

frontier get kubeconfig azure-frontier-k3s -n frontier-test

You will be followed by a prompt asking the client to enter the name of the YAML file. Be sure to include .yaml to the end of the file name. For this example, we will call our file frontier-cluster-test.yaml. Below is our expected output:

Frontier CLI Get Kubeconfig Prompt

You can view the contents within your kubeconfig file using the cat command.

cat frontier-cluster-test.yaml

Expected Output:

Frontier CLI Get Kubeconfig Output Example

If you are unable to retrieve and create the kubeconfig file for your cluster, it may be you do not have authorized permissions to perform this action. Contact your supervisor for any questions or issues on retrieving your cluster’s kubeconfig file.