Deploying YDB in AWS EKS

To use Kubernetes to create a cluster YDB, follow the steps below.

Before you start

  1. Configure awscli and eksctl to work with AWS resources according to the documentation.

  2. Install the Kubernetes CLI kubectl.

  3. Create a Kubernetes cluster.

    You can use an existing Kubernetes cluster or create a new one.


    Make sure that you're using Kubernetes version 1.20 or higher.

    How to create Kubernetes cluster
      eksctl create cluster \
        --name yandex-database \
        --nodegroup-name standard-workers \
        --node-type c5a.2xlarge \
        --nodes 3 \
        --nodes-min 1 \
        --nodes-max 4

    A Kubernetes cluster named yandex-database is created. The --node-type flag indicates that the cluster is deployed using c5a.2xlarge (8vCPUs, 16 GiB RAM) instances. This meets our guidelines for running YDB.

    It takes 10 to 15 minutes on average to create a cluster. Wait for the process to complete before proceeding to the next step of YDB deployment. The kubectl configuration will be automatically updated to work with the cluster after it is created.

  4. Install the Kubernetes Helm 3 package manager.

  5. Add a repository for Yandex.Cloud to Helm:

    Run the command:

    helm repo add ydb
    • ydb: The repository alias.
    • The repository URL.


    "ydb" has been added to your repositories
  6. Update the Helm chart index:

    Run the command:

    helm repo update


    Hang tight while we grab the latest from your chart repositories...
    ...Successfully got an update from the "ydb" chart repository
    Update Complete. ⎈Happy Helming!⎈

Install the YDB controller in the cluster

Install YDB in the standard configuration:

Run the command:

helm install ydb-operator ydb/operator
  • ydb-operator: The release name.
  • ydb/operator: The name of the chart in the repository you added earlier.


NAME: ydb-operator
LAST DEPLOYED: Thu Aug 12 19:32:28 2021
NAMESPACE: default
STATUS: deployed

Create a YDB cluster

Apply the manifest for creating a YDB cluster:

Run the command:

kubectl apply -f samples/storage.yaml

This command creates a StatefulSet object that describes a set of containers with stable network IDs and disks assigned to them, as well as Service and ConfigMap objects that are required for the cluster to work.

You can check the progress of YDB cluster creation using the following commands:

kubectl get
kubectl describe

Wait until the status of the Storage resource changes to Ready.


The cluster configuration is static. The controller won't process any changes when the manifest is reapplied. You can only update cluster parameters such as version or disk size by creating a new cluster.

The standard configuration includes the minimum required 9 storage nodes, 80 GB each.

For YDB to work efficiently, we recommend using physical (not virtual) disks larger than 800 GB as block devices.

The minimum disk size is 80 GB, otherwise the YDB node won't be able to use the device. Correct and uninterrupted operation with minimum-size disks is not guaranteed. We recommend using such disks exclusively for informational purposes.


Configurations with disks less than 800 GB or any types of storage system virtualization cannot be used for production services or system performance testing.

Create a database

Apply the manifest for creating a database:

Run the command:

kubectl apply -f samples/database.yaml


The key value must match the name of the storage resource of the cluster part.

After processing the manifest, a StatefulSet object that describes a set of dynamic nodes is created. The created database will be accessible from inside the Kubernetes cluster by the database-sample DNS name or the database-sample.<namespace>.svc.cluster.local FQDN, where namespace indicates the namespace that the release was installed. The database is connected to through port 2135.

View the status of the created resource:

kubectl describe

Name:         database-sample
Namespace:    default
Labels:       <none>
Annotations:  <none>
API Version:
Kind:         Database
  State:  Ready
  Type     Reason              Age    From          Message
  ----     ------              ----   ----          -------
  Normal   Provisioning        8m10s  ydb-operator  Resource sync is in progress
  Normal   Provisioning        8m9s   ydb-operator  Resource sync complete
  Normal   TenantInitialized   8m9s   ydb-operator  Tenant /root/database-sample created

The database is ready to run.

Test the controller

Test how YDB works:

  1. Check that all nodes are in the Ready status:

    kubectl get pods
    NAME                READY   STATUS    RESTARTS   AGE
    database-sample-0   1/1     Running   0          1m
    database-sample-1   1/1     Running   0          1m
    database-sample-2   1/1     Running   0          1m
    database-sample-3   1/1     Running   0          1m
    database-sample-4   1/1     Running   0          1m
    database-sample-5   1/1     Running   0          1m
    storage-sample-0    1/1     Running   0          1m
    storage-sample-1    1/1     Running   0          1m
    storage-sample-2    1/1     Running   0          1m
    storage-sample-3    1/1     Running   0          1m
    storage-sample-4    1/1     Running   0          1m
    storage-sample-5    1/1     Running   0          1m
    storage-sample-6    1/1     Running   0          1m
    storage-sample-7    1/1     Running   0          1m
    storage-sample-8    1/1     Running   0          1m
  2. Start a new pod using the YDB CLI:

    kubectl run -it --rm ydb-cli bash
  3. Query the YDB database:

    ydb \
      --endpoint grpc://database-sample-grpc:2135 \
      --database /root/database-sample \
      table query execute --query 'select 1;'
    • --endpoint: Database endpoint.
    • --database: The name of the created database.
    • --query: Query text.


    | column0 |
    | 1       |

    For more on YDB CLI commands, see the documentation.

Release the resources you don't use

If you no longer need the created resources, delete them:

  1. To delete a YDB database, just delete the Database resource mapped to it:

    kubectl delete database-sample
  2. To delete a YDB cluster, run the following commands:

    kubectl delete storage-sample
    kubectl delete pvc -l
  3. To remove the YDB controller from the Kubernetes cluster, delete the release created by Helm:

    helm delete ydb-operator
    • ydb-operator: The name of the release that the controller was installed under.