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

# How to connect to Managed Service for Kubernetes® clusters using kubectl

Use the public endpoint to connect to the cluster from the internet and the private endpoint to connect from a Compute virtual machine.

<Tabs>
  <Tab title="From the internet">
    1. Generate a kubeconfig file:

       ```bash theme={null}
       nebius mk8s cluster get-credentials \
         --id <cluster_ID> --external
       ```

    2. Use kubectl:

       ```bash theme={null}
       kubectl cluster-info
       ```
  </Tab>

  <Tab title={`From a Compute VM`}>
    <Warning>
      **Requirements to connect to a VM with private IP address**

      To connect to a Managed Service for Kubernetes cluster from a Compute VM using a [private IP address](/compute/virtual-machines/network#private-ip) or another cluster using a private load balancer, both must be in the same [region](/overview/regions) and subnet.
    </Warning>

    1. Generate a kubeconfig file:

       ```bash theme={null}
       nebius mk8s cluster get-credentials \
         --id <cluster_ID> --internal
       ```

    2. Use kubectl:

       ```bash theme={null}
       kubectl cluster-info
       ```
  </Tab>
</Tabs>
