> ## 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 get started with Managed Service for Kubernetes®: Create your first cluster for Kubernetes

With [Kubernetes](https://kubernetes.io/), you can efficiently manage and scale your containerized ML/AI applications and ensure they are portable and fault-tolerant.

This guide will help you get started with Managed Service for Kubernetes, a service provided by Nebius AI Cloud. You will learn how to set up your environment for Managed Service for Kubernetes, create your first *cluster for Kubernetes* and a child *node group*, and connect to the cluster.

## Prepare your environment

### Install the CLIs and tools

In this guide, you will use the terminal in your environment, e.g. on your local machine, to run commands that create and manage Nebius AI Cloud resources. The commands use certain command line interfaces (CLIs) and tools that you need to install first. The installation commands in copy-and-paste blocks are as follows:

<CodeGroup>
  ```bash Ubuntu theme={null}
  sudo apt-get install jq
  curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
  sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
  curl -sSL https://storage.eu-north1.nebius.cloud/cli/install.sh | bash
  nebius profile create
  ```

  ```bash macOS theme={null}
  brew install jq
  curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl"
  chmod +x ./kubectl
  sudo mv ./kubectl /usr/local/bin/kubectl
  sudo chown root: /usr/local/bin/kubectl
  curl -sSL https://storage.eu-north1.nebius.cloud/cli/install.sh | bash
  nebius profile create
  ```
</CodeGroup>

These commands will install the following:

* **kubectl** ([how to install](https://kubernetes.io/docs/tasks/tools/#kubectl)) is the Kubernetes command line interface.
* **jq** ([how to install](https://jqlang.github.io/jq/download/)) parses JSON outputs from the Nebius AI Cloud CLI and extracts resource IDs for other commands.
* **Nebius AI Cloud CLI** ([how to install](../cli/install)) manages all Nebius AI Cloud resources.

The last command, `nebius profile create`, will guide you through several prompts. After you complete the prompts, your browser will open the Nebius AI Cloud web console sign-in screen. Sign in to the web console to complete the initialization. If you have access to multiple tenants, the CLI will prompt you to choose a tenant ID. After that, save your project ID in the CLI configuration:

If the project ID has not been configured during the `nebius profile create` flow, [get the project ID](/iam/manage-projects#how-to-get-a-project-id) and save it in the CLI configuration:

```bash theme={null}
nebius config set parent-id <project_ID>
```

## Create a cluster and a node group

1. Your cluster's control plane and nodes will use private IP addresses from the default subnet. Get its ID:

   ```bash theme={null}
   export NB_SUBNET_ID=$(nebius vpc subnet list \
     --format json \
     | jq -r '.items[0].metadata.id')
   ```

2. Create a cluster with a public endpoint allocated to its control plane, and get the cluster ID:

   ```bash theme={null}
   export NB_CLUSTER_ID=$(nebius mk8s cluster create \
     --name quickstart-mk8s-cluster \
     --control-plane-subnet-id $NB_SUBNET_ID \
     --control-plane-endpoints-public-endpoint true \
     --format json | jq -r '.metadata.id')
   ```

   The cluster's control plane will run the Kubernetes version 1.32, which is the default version for Managed Kubernetes clusters. To explicitly specify another supported [version](./versions), add the `--control-plane-version <major.minor>` parameter to <code>nebius mk8s cluster create</code>.

3. Create a node group and add it to the cluster:

   ```bash theme={null}
   export NODE_USERNAME="user"
   nebius mk8s node-group create \
     --name quickstart-mk8s-nodes \
     --parent-id $NB_CLUSTER_ID \
     --fixed-node-count 2 \
     --template-resources-platform "cpu-e2" \
     --template-resources-preset "2vcpu-8gb" \
     --template-boot-disk-type network_ssd \
     --template-boot-disk-size-bytes 137438953472 \
     --template-cloud-init-user-data "$(cat <<EOF
   users:
     - name: $NODE_USERNAME
       sudo: ALL=(ALL) NOPASSWD:ALL
       shell: /bin/bash
       ssh_authorized_keys:
         - $(cat ~/.ssh/id_ed25519.pub)
   EOF
   )" \
     --template-network-interfaces "[{\"public_ip_address\": {},
                                      \"subnet_id\": \"$NB_SUBNET_ID\"}]"
   ```

   The command creates a group of 2 nodes. Each node is a non-GPU (`--template-resources-platform "cpu-e2"`) virtual machine that has 2 vCPUs, 8 <Tooltip tip={<>Nebius uses binary units. For example, a <i>gibibyte</i> (GiB) is 2<sup>30</sup> (1024<sup>3</sup>) bytes.</>}>GiB</Tooltip> of RAM, a 128 GiB Network SSD boot disk and a public IP address. You will be able to connect to both nodes via SSH as `user` (as specified in `NODE_USERNAME`).

## Connect to the cluster

1. Create a kubeconfig file containing the cluster details for kubectl:

   ```bash theme={null}
   nebius mk8s cluster get-credentials \
     --id $NB_CLUSTER_ID --external
   ```

2. Check that the cluster is accessible. For example:

   * Get addresses of the control plane and cluster services:

     ```bash theme={null}
     kubectl cluster-info
     ```

   * Get the list of pods:

     ```bash theme={null}
     kubectl get pods -A
     ```

## What's next

* [How to create and modify Managed Service for Kubernetes® clusters](./clusters/manage)
* [Creating and modifying Managed Service for Kubernetes® node groups](./node-groups/manage)
