> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fly.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect to an FKS cluster

<Warning>
  Fly Kubernetes is in closed beta and not recommended for critical production usage. To report issues or provide feedback, email us at [beta@fly.io](mailto:beta@fly.io).
</Warning>

Fly Kubernetes clusters are accessible over an organization's [private WireGuard network](/networking/private-networking). To connect to a cluster, you need a WireGuard configuration.
Follow the [Private Network VPN instructions](/networking/private-networking#private-network-vpn) to set up a permanent WireGuard connection to your Fly.io IPv6 private network.

To connect to your cluster, you need a kubeconfig file. These are generated when your [cluster is created](/kubernetes/clusters). They can also be retrieved using `flyctl`.
First, we need our cluster name:

```
> fly ext k8s ls
NAME                                    ORG             PRIMARY REGION
fks-flyio-fksdemo                       flyio           iad
```

Then, we can use `flyctl` to save our kubeconfig to disk. It is automatically saved with the name `kubeconfig` in the current directory

```
> fly ext k8s save-kubeconfig
> ls
kubeconfig somefile.txt
```

With the kubeconfig file, you can connect to your cluster. To make life easier, you can move the kubeconfig file to the default location kubectl searches for it, `$HOME/.kube`, under the name `config`.
Alternatively set the environment variable `KUBECONFIG` to the path to the kubeconfig file

```
export KUBECONFIG=/path/to/kubeconfig
```

Once set up, you can use `kubectl`:

```
> kubectl get ns
NAME              STATUS   AGE
kube-public       Active   22d
kube-node-lease   Active   22d
default           Active   22d
kube-system       Active   22d
```

## Related topics

* [Create an FKS cluster](/kubernetes/clusters)
* [Configure FKS Services](/kubernetes/services)
