---
title: "Connect to a Managed Kubernetes cluster"
sidebar_label: "Connect to a cluster"
sidebar_position: 1
description: "How to connect to a cluster and configure the environment for working with kubectl"
---

import Formbricks from '@theme/MDXComponents/Formbricks';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import { TabItemLabel } from '@selectel/docux/components';

# Connect to a Managed Kubernetes cluster

To start working with the cluster, you need to configure [kubectl](https://kubernetes.io/docs/reference/kubectl/kubectl/).

:::info

We recommend performing all actions with cluster nodes, load balancers, and volumes only via kubectl.

:::

After [updating the certificates for system components](/managed-kubernetes/clusters/update-certificate.mdx#update-certificates-when-error-occurs), reconnect to the cluster.

<Tabs>
  <TabItem value="Linux" default>
    <TabItemLabel>
      Linux
    </TabItemLabel>

    1. install the Kubernetes CLI [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/).

    2. In the [Control panel](https://my.selectel.ru/mks/), on the top menu, click **Products** and select **Managed Kubernetes**.

    3. In the **Clusters** section, open the cluster page → **Settings**.

    4. If you are using a private Kube API, check access to it. The IP address is specified in the **Kube API** field.

    5. Click **Download kubeconfig**. Downloading the kubeconfig file is unavailable if the cluster status is `PENDING_CREATE`, `PENDING_ROTATE_CERTS`, `PENDING_DELETE`` or ERROR`.

    6. Export the `KUBECONFIG` environment variable with the path to the kubeconfig file:

       ```bash
       export KUBECONFIG=<path>
       ```

       Specify `<path>` — the path to the `cluster_name.yaml` kubeconfig file, where `<cluster_name>` is the cluster name.

    7. Check if the configuration is correct — connect to the cluster via kubectl:

       ```bash
       kubectl get nodes
       ```

       Nodes must be in the `Ready` status.
  </TabItem>

  <TabItem value="Windows">
    <TabItemLabel>
      Windows
    </TabItemLabel>

    1. Install the [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/) Kubernetes command-line client.

    2. In the [Control panel](https://my.selectel.ru/mks/), on the top menu, click **Products** and select **Managed Kubernetes**.

    3. In the **Clusters** section, open the cluster page → **Settings**.

    4. If you are using a private Kube API, check access to it. The IP address is specified in the **Kube API** field.

    5. Click **Download kubeconfig**. Downloading the kubeconfig file is unavailable if the cluster status is `PENDING_CREATE`, `PENDING_ROTATE_CERTS`, `PENDING_DELETE`` or ERROR`.

    6. Run PowerShell as administrator.

    7. Export the `KUBECONFIG` environment variable with the path to the kubeconfig file:

       ```bash
       $env:KUBECONFIG = <path>
       ```

       Specify `<path>` — the path to the `cluster_name.yaml` kubeconfig file, where `<cluster_name>` is the cluster name.

    8. Check if the configuration is correct — connect to the cluster via kubectl:

       ```bash
       kubectl get nodes
       ```

       Nodes must be in the `Ready` status.
  </TabItem>
</Tabs>

<Formbricks />
