# Download Kubeconfig

A `kubeconfig` file is used to configure access to Kubernetes.

{% tabs %}
{% tab title="Public Node Pools" %}
You can download the `kubeconfig` file:

* [<mark style="color:blue;">Using configuration management tools</mark>](#using-configuration-management-tools)
* [<mark style="color:blue;">Using Kubernetes Manager</mark>](#using-kubernetes-manager)

### Using configuration management tools

You can download the `kubeconfig` file using configuration management tools such as [<mark style="color:blue;">IonosCTL CLI</mark>](https://docs.ionos.com/cli-ionosctl/subcommands/managed-kubernetes/k8s-kubeconfig-get), [<mark style="color:blue;">Ansible</mark>](https://docs.ionos.com/ansible/api/managed-kubernetes/k8s_config), and [<mark style="color:blue;">Terraform</mark>](https://docs.ionos.com/terraform-provider/api/managed-kubernetes/data-sources/k8s_cluster#example-of-dumping-the-kube_config-raw-data-into-a-yaml-file). Following are a few options to retrieve the `kubeconfig` files.

| Tool                                                                                                                                                                                                 | Parameter Reference       | Description                                                                                                                                                                                                                                                                                                                                                                                                             |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [<mark style="color:blue;">IonosCTL CLI</mark>](https://docs.ionos.com/cli-ionosctl/subcommands/managed-kubernetes/k8s-kubeconfig-get)                                                               | `K8s Cluster Id`          | <p>You can retrieve the <code>kubeconfig</code> file and save it using a single command from <strong>IonosCTL CLI</strong>. For more information, see <a href="https://docs.ionos.com/cli-ionosctl/subcommands/managed-kubernetes/kubeconfig/get#examples"><mark style="color:blue;">example</mark></a>.<br><br><code>ionosctl k8s kubeconfig get --cluster-id CLUSTER\_ID</code></p>                                   |
| [<mark style="color:blue;">Ansible</mark>](https://docs.ionos.com/ansible/api/managed-kubernetes/k8s_config)                                                                                         | `k8s_cluster config_file` | <p>You can retrieve the <code>kubeconfig</code> by specifying the <code>kubeconfig</code> parameter in the <strong>Ansible YAML</strong> file.<br><br>For more information, see <a href="https://docs.ionos.com/ansible/api/managed-kubernetes/k8s_config"><mark style="color:blue;">Kubernetes configuration</mark></a>.</p>                                                                                           |
| [<mark style="color:blue;">Terraform</mark>](https://docs.ionos.com/terraform-provider/api/managed-kubernetes/data-sources/k8s_cluster#example-of-dumping-the-kube_config-raw-data-into-a-yaml-file) | `filename`                | <p>You can interact with the <code>kubeconfig</code> resources by providing proper configurations.<br><br>For more information, see <a href="https://docs.ionos.com/terraform-provider/api/managed-kubernetes/data-sources/k8s_cluster#example-of-dumping-the-kube_config-raw-data-into-a-yaml-file"><mark style="color:blue;">Example of dumping the <code>kubeconfig</code> raw data into a yaml file</mark></a>.</p> |

{% hint style="info" %}
**Note:** If you do not want to use any tools like **IonosCTL CLI**, **Ansible**, or **Terraform**, you can retrieve the `kubeconfig` file directly from the [<mark style="color:blue;">Get Kubernetes Configuration File</mark>](https://api.ionos.com/docs/cloud/v6/#tag/Kubernetes/operation/k8sKubeconfigGet) API using tools like `cURL` or `Wget`.
{% endhint %}

### Using Kubernetes Manager

1. In the **DCD**, go to **Menu** > **Containers** > **Managed Kubernetes**.
2. In **Kubernetes Manager**, select a cluster from the cluster list.
3. In the **Cluster Settings** tab, select either **kubeconfig.yaml** or **kubeconfig.json** from the drop-down list to download the `kubeconfig` file.

![Download Kubeconfig file using the Kubernetes Manager](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-fd3506c11999128d3b95a8cd6667d55f5563dde3%2Fyaml-json-selection.png?alt=media)

4. Alternatively, you can also select the Kubernetes element in the Workspace and download the `kubeconfig` file in the [<mark style="color:blue;">Inspector pane</mark>](https://docs.ionos.com/cloud/~/revisions/AMiYziCllTKB2y2lmONY/getting-started/basic-tutorials/data-center-basics#the-inspector-pane).

![Download Kubeconfig file using the Inspector pane](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-2d62979a04a774fb9145567b6b90cc592fad6e39%2Finspector_pane_private.png?alt=media)

{% hint style="success" %}
**Result:** The `kubeconfig` file is successfully downloaded.
{% endhint %}
{% endtab %}

{% tab title="Private Node Pools" %}
You can download the `kubeconfig` file:

* [<mark style="color:blue;">Using configuration management tools</mark>](#using-configuration-management-tools-1)
* [<mark style="color:blue;">Using Kubernetes Manager</mark>](#using-kubernetes-manager-1)

### Using configuration management tools

You can download the `kubeconfig` file using configuration management tools such as [<mark style="color:blue;">IonosCTL CLI</mark>](https://docs.ionos.com/cli-ionosctl/subcommands/managed-kubernetes/k8s-kubeconfig-get), [<mark style="color:blue;">Ansible</mark>](https://docs.ionos.com/ansible/api/managed-kubernetes/k8s_config), and [<mark style="color:blue;">Terraform</mark>](https://docs.ionos.com/terraform-provider/api/managed-kubernetes/data-sources/k8s_cluster#example-of-dumping-the-kube_config-raw-data-into-a-yaml-file). Following are a few options to retrieve the `kubeconfig` files.

| Tool                                                                                                                                                                                                 | Parameter Reference       | Description                                                                                                                                                                                                                                                                                                                                                                                                             |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [<mark style="color:blue;">IonosCTL CLI</mark>](https://docs.ionos.com/cli-ionosctl/subcommands/managed-kubernetes/k8s-kubeconfig-get)                                                               | `K8s Cluster Id`          | <p>You can retrieve the <code>kubeconfig</code> file and save it using a single command from <strong>IonosCTL CLI</strong>. For more information, see <a href="https://docs.ionos.com/cli-ionosctl/subcommands/managed-kubernetes/kubeconfig/get#examples"><mark style="color:blue;">example</mark></a>.<br><br><code>ionosctl k8s kubeconfig get --cluster-id CLUSTER\_ID</code></p>                                   |
| [<mark style="color:blue;">Ansible</mark>](https://docs.ionos.com/ansible/api/managed-kubernetes/k8s_config)                                                                                         | `k8s_cluster config_file` | <p>You can retrieve the <code>kubeconfig</code> by specifying the <code>kubeconfig</code> parameter in the <strong>Ansible YAML</strong> file.<br><br>For more information, see <a href="https://docs.ionos.com/ansible/api/managed-kubernetes/k8s_config"><mark style="color:blue;">Kubernetes configuration</mark></a>.</p>                                                                                           |
| [<mark style="color:blue;">Terraform</mark>](https://docs.ionos.com/terraform-provider/api/managed-kubernetes/data-sources/k8s_cluster#example-of-dumping-the-kube_config-raw-data-into-a-yaml-file) | `filename`                | <p>You can interact with the <code>kubeconfig</code> resources by providing proper configurations.<br><br>For more information, see <a href="https://docs.ionos.com/terraform-provider/api/managed-kubernetes/data-sources/k8s_cluster#example-of-dumping-the-kube_config-raw-data-into-a-yaml-file"><mark style="color:blue;">Example of dumping the <code>kubeconfig</code> raw data into a yaml file</mark></a>.</p> |

{% hint style="info" %}
**Note:** If you do not want to use any tools like **IonosCTL CLI**, **Ansible**, or **Terraform**, you can retrieve the `kubeconfig` file directly from the [<mark style="color:blue;">Get Kubernetes Configuration File</mark>](https://api.ionos.com/docs/cloud/v6/#tag/Kubernetes/operation/k8sKubeconfigGet) API using tools like `cURL` or `Wget`.
{% endhint %}

### Using Kubernetes Manager

To download the `kubeconfig` file using Kubernetes Manager, follow these steps:

1. In the **DCD**, go to **Menu** > **Containers** > **Managed Kubernetes**.
2. In **Kubernetes Manager**, select a cluster from the cluster list.
3. In the **Cluster Settings** tab, select either **kubeconfig.yaml** or **kubeconfig.json** from the drop-down list to download the `kubeconfig` file.

![Download Kubeconfig file using the Kubernetes Manager](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-37c16e00d9409e8bc6458dedbdd038231a6e4627%2Fprivate_kubeconfig.png?alt=media)

4. Alternatively, you can also select the Kubernetes element in the Workspace and download the `kubeconfig` file in the [<mark style="color:blue;">Inspector pane</mark>](https://docs.ionos.com/cloud/~/revisions/AMiYziCllTKB2y2lmONY/getting-started/basic-tutorials/data-center-basics#the-inspector-pane).

![Download Kubeconfig file using the Inspector pane](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-2d62979a04a774fb9145567b6b90cc592fad6e39%2Finspector_pane_private.png?alt=media)

{% hint style="success" %}
**Result:** The `kubeconfig` file is successfully downloaded.
{% endhint %}
{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Note**: Only **administrators** can retrieve the `kubeconfig` file without a node pool. All other users need to create a node pool first.
{% endhint %}
