This section covers additional aspects of Deckhouse Platform (DP) integration with Yandex Cloud:

  • Attaching cloud disks via CSI.
  • Automatic StorageClass creation.
  • Use of load balancers.
  • Specifics of applying changes.
  • Working with CloudStatic nodes and bastion hosts.

Storage (CSI and StorageClass)

DP integrates with Yandex Cloud block storage via the Container Storage Interface (CSI) component. This allows DP clusters to automatically provision and attach disks and use standard Kubernetes PersistentVolumeClaim resources for working with the storage.

DP automatically creates StorageClass resources for all supported Yandex Cloud disk types, enabling immediate storage usage without the need to define classes manually.

The following disk types are supported:

Disk type StorageClass name Notes
network-hdd network-hdd —
network-ssd network-ssd —
network-ssd-nonreplicated network-ssd-nonreplicated Size must be a multiple of 93 GB
network-ssd-io-m3 network-ssd-io-m3 Size must be a multiple of 93 GB

The sizes of network-ssd-nonreplicated and network-ssd-io-m3 disks must be multiples of 93 GB. Otherwise, volume provisioning will fail.

Excluding unnecessary StorageClasses

If certain disk types won’t be used in the cluster, you can disable automatic creation of the corresponding StorageClass objects using the settings.storageClass.exclude parameter in the ModuleConfig resource:

settings:
  storageClass:
    exclude:
    - network-ssd-.*
    - network-hdd

In this example, DP will not create StorageClass resources for any network-ssd or network-hdd disks.

Setting the default StorageClass

By default, DP determines the StorageClass using the storageclass.kubernetes.io/is-default-class=true annotation.

To explicitly set a different default StorageClass, use the global DP parameter global.defaultClusterStorageClass. You can modify it with the following command:

kubectl edit mc global

If defaultClusterStorageClass is not specified, DP determines the default StorageClass in the following order:

  • A StorageClass with the annotation storageclass.kubernetes.io/is-default-class='true' (if it exists in the cluster).
  • The first StorageClass in alphabetical order auto-created by the cloud provider.
  • The default value of defaultClusterStorageClass is an empty string ("").

Resizing a PVC

You can increase the size of an existing PVC by changing the value of the spec.resources.requests.storage parameter, without stopping or recreating the pod that uses it.

After the value of spec.resources.requests.storage is changed, the CSI driver performs the following operations:

  • increases the size of the disk in Yandex Cloud;
  • updates the size of the associated PersistentVolume;
  • expands the file system on the node to which the volume is attached.

During the operation, the pod continues running, and the mounted volume remains available to the application. After the resize operation is complete, the new file system size becomes available inside the container without restarting the pod.

Decreasing the size of a PVC is not supported.

To increase the size of a PVC, follow these steps:

  1. Get the name of the StorageClass used by the PVC:

    d8 k -n <NAMESPACE> get pvc <PVC_NAME> \
      -o jsonpath='{.spec.storageClassName}{"\n"}'
    

    Where:

    • <NAMESPACE> — the namespace containing the PVC;
    • <PVC_NAME> — the name of the PVC to resize.

    For example:

    d8 k -n production get pvc application-data \
      -o jsonpath='{.spec.storageClassName}{"\n"}'
    

    Example output:

    network-ssd
    

    In this example, the application-data PVC uses the network-ssd StorageClass.

  2. Make sure that the StorageClass allows volume expansion:

    d8 k get storageclass <STORAGECLASS_NAME> \
      -o jsonpath='{.allowVolumeExpansion}{"\n"}'
    

    Where <STORAGECLASS_NAME> is the name of the StorageClass obtained in the previous step.

    For example:

    d8 k get storageclass network-ssd \
      -o jsonpath='{.allowVolumeExpansion}{"\n"}'
    

    Example output:

    true
    
  3. Check the current status and size of the PVC:

    d8 k -n <NAMESPACE> get pvc <PVC_NAME>
    

    For example:

    d8 k -n production get pvc application-data
    

    Example output:

    NAME               STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS
    application-data   Bound    pvc-65e92674-077c-4b4f-b65d-19e92f04e103   20Gi       RWO            network-ssd
    

    Make sure that:

    • the PVC is in the Bound state;
    • the CAPACITY field shows the current PVC size;
    • the STORAGECLASS field shows the StorageClass checked in the previous step.
  4. Increase the PVC size:

    d8 k -n <NAMESPACE> edit pvc <PVC_NAME>
    

    For example:

    d8 k -n production edit pvc application-data
    

    Specify the new PVC size in the spec.resources.requests.storage field:

    spec:
      resources:
        requests:
          storage: 30Gi
    

    In this example, the PVC size is increased to 30Gi.

    Save the changes and close the editor.

    For the network-ssd-nonreplicated and network-ssd-io-m3 StorageClasses, the size must be a multiple of 93Gi.

  5. Wait for the PVC resize operation to complete:

    d8 k -n <NAMESPACE> get pvc <PVC_NAME> --watch
    

    Where:

    • <NAMESPACE> — the namespace containing the PVC;
    • <PVC_NAME> — the name of the PVC being resized.

    For example:

    d8 k -n production get pvc application-data --watch
    

    During the resize operation, the CAPACITY field may continue to show the previous size:

    NAME               STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS
    application-data   Bound    pvc-65e92674-077c-4b4f-b65d-19e92f04e103   20Gi       RWO            network-ssd
    

    The operation is complete when the CAPACITY field shows the new PVC size:

    NAME               STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS
    application-data   Bound    pvc-65e92674-077c-4b4f-b65d-19e92f04e103   30Gi       RWO            network-ssd
    
  6. Check the PVC events:

    d8 k -n <NAMESPACE> describe pvc <PVC_NAME>
    

    For example:

    d8 k -n production describe pvc application-data
    

    The following events may appear during the resize operation:

    ExternalExpanding
    Resizing
    FileSystemResizeRequired
    

    The following event indicates that the file system was successfully expanded:

    FileSystemResizeSuccessful
    

    For example:

    Normal  FileSystemResizeSuccessful  kubelet  MountVolume.NodeExpandVolume succeeded for volume "pvc-65e92674-077c-4b4f-b65d-19e92f04e103"
    
  7. Check the file system size inside the pod:

    d8 k -n <NAMESPACE> exec <POD_NAME> -- \
      df -hT <MOUNT_PATH>
    

    Where:

    • <NAMESPACE> — the namespace containing the pod;
    • <POD_NAME> — the name of the pod using the PVC;
    • <MOUNT_PATH> — the path inside the container where the PVC is mounted.

    For example:

    d8 k -n production exec application-0 -- \
      df -hT /data
    

    Example output:

    Filesystem   Type   Size    Used   Avail   Use%   Mounted on
    /dev/vde     ext4   29.4G   22M    29.4G    1%    /data
    

    The actual file system size may be slightly smaller than the PVC size due to file system metadata.

Load balancing

External LoadBalancer

DP automatically watches for Kubernetes Service objects of type LoadBalancer. When such a service is created, DP creates the following resources:

  • NetworkLoadBalancer: A Yandex Cloud network load balancer.
  • TargetGroup: A group of endpoints for traffic distribution.

These resources allow Kubernetes LoadBalancer services to receive traffic from the internet or internal networks, depending on the configuration.

For more details on the architecture, refer to the Kubernetes Cloud Controller Manager for Yandex Cloud documentation.

Internal LoadBalancer

To create an internal load balancer, you must explicitly specify the subnet where the load balancer listener should be created.

To do this, add the following annotation to the Service object:

metadata:
  annotations:
    yandex.cpi.flant.com/listener-subnet-id: <SubnetID>

SubnetID refers to the ID of the subnet where the internal listener for the Yandex LoadBalancer will be created. This allows you to control the load balancer’s network exposure and limit it to internal addresses only.

The default behavior (external or internal LB) depends on the cluster configuration. To explicitly choose the type, use the yandex.cpi.flant.com/loadbalancer-external annotation.

Service annotations

Default values are configured in the cluster for placing load balancer resources (the network for the target group and the subnet for the Listener). These values are set automatically during cluster setup and can be overridden with annotations at the individual Service level.

The following annotations are supported by Yandex Cloud Controller Manager:

  1. yandex.cpi.flant.com/target-group-network-id — specifies the NetworkID in which the target group for this Service will be created. Overrides the corresponding default value.
  2. yandex.cpi.flant.com/listener-subnet-id — sets the SubnetID for the Listeners of the LB created for this Service. Overrides the corresponding default value.
  3. yandex.cpi.flant.com/listener-address-ipv4 — sets a predefined IPv4 address for the Listeners (supported for both internal and external LBs).
  4. yandex.cpi.flant.com/loadbalancer-external — enables creation of an external LB for this Service (use it when you need to explicitly create an external load balancer). Overrides the default behavior.
  5. yandex.cpi.flant.com/target-group-name-prefix — specifies the name prefix of the target group used by the LoadBalancer. The annotation on the Service identifies the target group but does not select nodes. To include nodes in the target group, set the same annotation value in spec.nodeTemplate.annotations in the NodeGroup. Yandex Cloud Controller Manager includes all suitable nodes carrying this annotation value, regardless of their NodeGroup. The target group name is formed as <ANNOTATION_VALUE><YANDEX_CLOUD_CLUSTER_NAME><NETWORK_ID>.

If separate target groups are created for the control plane or master nodes, add the label node.kubernetes.io/exclude-from-external-load-balancers: "" to the master nodes. This prevents the controller from automatically adding master nodes to new target groups for load balancers. If you create your own load balancer for master nodes and want YCC to also be able to place its load balancers on master nodes, pre-create a target group with a name matching the pattern ${CLUSTER-NAME}${VPC.ID}.

Using a separate target group for a NodeGroup

By default, Yandex Cloud Controller Manager adds all suitable cluster nodes to the default target group. To assign nodes to a separate target group, use the yandex.cpi.flant.com/target-group-name-prefix annotation.

  1. In the NodeGroup whose nodes should be included in a separate target group, specify the yandex.cpi.flant.com/target-group-name-prefix annotation in the spec.nodeTemplate.annotations parameter. For example:

    spec:
      nodeTemplate:
        annotations:
          yandex.cpi.flant.com/target-group-name-prefix: frontend-
    

    The annotation is propagated to the Node objects. Yandex Cloud Controller Manager adds all suitable nodes carrying the same annotation value to the target group, regardless of their NodeGroup.

  2. In the Service object of the LoadBalancer type, specify the same annotation with the same value. For example:

    metadata:
      annotations:
        yandex.cpi.flant.com/target-group-name-prefix: frontend-
    

    The annotation on the Service identifies the target group used by the LoadBalancer but does not select nodes.

  3. Make sure that the values of yandex.cpi.flant.com/target-group-name-prefix in the NodeGroup and Service match. In the example above, both resources use the frontend- value.

  4. The target group will be created with a name generated according to the following pattern:

    <ANNOTATION_VALUE><YANDEX_CLOUD_CLUSTER_NAME><NETWORK_ID>
    

    For example, if the annotation value is frontend-, the cluster name is my-cluster-, and the network ID is enp123456789, the target group name will be:

    frontend-my-cluster-enp123456789
    

Configuration example:

apiVersion: deckhouse.io/v1
kind: NodeGroup
metadata:
  name: frontend
spec:
  nodeType: CloudEphemeral
  nodeTemplate:
    annotations:
      yandex.cpi.flant.com/target-group-name-prefix: frontend-
---
apiVersion: v1
kind: Service
metadata:
  name: nginx-frontend
  annotations:
    yandex.cpi.flant.com/target-group-name-prefix: frontend-
spec:
  type: LoadBalancer

Yandex Cloud does not allow a single target, identified by the (SubnetID, IP) pair, to belong to multiple target groups at the same time.

When the target group is changed, Yandex Cloud Controller Manager first removes the target from the current group and then adds it to the new one. This transition may cause a brief interruption in traffic handling.

Nodes with a dedicated target group prefix are excluded from the default target group. As a result, load balancers that use the default target group stop routing traffic to those nodes.

This automatic transition is performed only between target groups managed by Yandex Cloud Controller Manager. If a target already belongs to another target group that is not managed by Yandex Cloud Controller Manager, remove it from that group before using the annotation.

After the prefix is changed or removed, the previous target group may remain empty. If it is no longer used by any load balancers, delete it manually.

Target group health checks

Health check parameters (for LB target groups created by the controller):

  1. yandex.cpi.flant.com/healthcheck-interval-seconds — how often to run the check, in seconds (default: 2).
  2. yandex.cpi.flant.com/healthcheck-timeout-seconds — how long to wait for an endpoint response, in seconds. If no response is received within this time, the check is considered failed (default: 1).
  3. yandex.cpi.flant.com/healthcheck-unhealthy-threshold — how many consecutive failed checks are required to mark an endpoint as unhealthy and exclude it from load balancing (default: 2).
  4. yandex.cpi.flant.com/healthcheck-healthy-threshold — how many consecutive successful checks are required to return an endpoint to healthy status and include it back in load balancing (default: 2).

Applying changes

DP does not recreate existing Machine objects when configuration parameters change. Node recreation occurs only when:

This behavior helps prevent unnecessary operations and node idling, but it means you must manually recreate VMs if needed.

If you change the YandexClusterConfiguration resource (for example, change provider settings, layout, subnets, etc.), run the following command to apply the changes:

dhctl converge

This command reconciles the cluster state with the configuration defined in the resources.

Changing networkType does not recreate CloudEphemeral nodes

In clusters that use Machine Controller Manager (MCM), changing the networkType parameter in a YandexInstanceClass resource does not trigger automatic recreation of existing CloudEphemeral nodes. Although the MachineClass is updated, the network acceleration type of existing virtual machines in Yandex Cloud remains unchanged.

DP intentionally does not take the networkType parameter into account when determining whether CloudEphemeral nodes should be recreated in MCM. If it did, updating DP would recreate CloudEphemeral nodes in all clusters where networkType is specified, even if its value had not changed.

In Cluster API, the networkType parameter is taken into account when determining whether nodes should be recreated, so changing it automatically triggers node recreation. New CloudEphemeral NodeGroups in Yandex Cloud use Cluster API by default.

If you changed networkType in an MCM-based cluster and want the new value to apply to existing CloudEphemeral nodes, recreate them manually — instructions in the documentation.

Integrating manually created VMs

DP allows you to connect existing VMs in Yandex Cloud to the Kubernetes cluster as nodes. These nodes are called CloudStatic and they are not directly managed by the node-manager module but can still be used in the cluster.

To manually connect a VM as a CloudStatic node, follow these steps:

  1. Retrieve the current nodeNetworkCIDR value from the cluster:

    kubectl -n kube-system get secret d8-provider-cluster-configuration -o json | \
      jq --raw-output '.data."cloud-provider-cluster-configuration.yaml"' | base64 -d | grep '^nodeNetworkCIDR'
    

    Expected output:

    nodeNetworkCIDR: 192.168.12.13/24
    

    Copy this value and use it in the VM metadata as value.

  2. Set the node-network-cidr parameter in the VM metadata:

    key: node-network-cidr
    value: <nodeNetworkCIDR from the cluster>
    

    The node-network-cidr parameter must match the value specified in the YandexClusterConfiguration resource under nodeNetworkCIDR.

Additional resources