Managing Kubernetes cluster node labels
You can add Kubernetes labels to all nodes in a node group at the same time. To do this, specify a set of labels using the node_labels
parameter when creating a node group.
-
Create a Kubernetes cluster.
You can use an existing Kubernetes cluster or create a new one.
-
Create a group of nodes with labels.
Management consoleCLI- In the management console
, select the folder where the Kubernetes cluster was created. - In the list of services, select Managed Service for Kubernetes.
- Select the Kubernetes cluster to create a node group for.
- On the Kubernetes cluster page, go to the Nodes manager tab.
- Click Create node group.
- Enter a node group name.
- In the Scaling section:
- Select the scaling policy type.
- Specify the number of nodes in the node group.
- Under Computing resources:
- Choose a platform.
- Specify the requisite number of vCPUs and the amount of RAM.
- Under Storage:
- Specify the Disk type:
- HDD: Standard network drive. Network block storage on an HDD.
- SSD: Fast network drive. Network block storage on an SSD.
- Specify the disk size.
- Specify the Disk type:
- Under Network settings:
- In the Public address field, choose a method for assigning an IP address:
- Auto: Assign a random IP address from the Nebius AI IP pool.
- No address: Don't assign a public IP address.
- Specify how nodes should be distributed across networks.
- In the Public address field, choose a method for assigning an IP address:
- Under Access, specify the information required to access the node:
- Enter the username in the Login field.
- In the SSH key field, paste the contents of the public key file.
- Under Maintenance window settings:
- In the Maintenance frequency field, choose the maintenance window:
- Anytime: Maintenance is allowed at any time.
- Daily: Maintenance is performed during the interval specified in the Time (UTC) and duration field.
- On selected days: Maintenance is performed during the interval specified in the Schedule by day field.
- In the Maintenance frequency field, choose the maintenance window:
- In the Additional section:
- In the Node labels field, click Add label and specify the label key and value. Add multiple labels if needed.
- Click Create node group.
Create a node group:
ncp managed-kubernetes node-group create \ --name k8s-labels-node \ --cluster-name k8s-labels \ --disk-type network-ssd \ --fixed-size 1 \ --node-labels environment=production,apps/tier=backend
Where:
--name
: The name of the node group.--cluster-name
: Name of the Kubernetes cluster where the node group is created.--disk-type
: Type of the disk on the node.--fixed-size
: Number of nodes in the group.--node-labels
: Node labels. You can specify multiple labels separated by commas.
Command result:
done (2m19s) id: catkuapro07enihqmk51 cluster_id: abcsk1s2f3fmb5h0pd94 created_at: "2020-09-24T13:32:24Z" name: k8s-labels-node status: RUNNING node_template: platform_id: standard-v2 resources_spec: memory: "4294967296" cores: "2" core_fraction: "100" boot_disk_spec: disk_type_id: network-ssd disk_size: "103079215104" v4_address_spec: {} scheduling_policy: {} scale_policy: fixed_scale: size: "1" allocation_policy: locations: - zone_id: eu-north1-c subnet_id: e9bm87gkjd81eroc6dqg deploy_policy: max_expansion: "3" instance_group_id: cl1v2gh33j1c71df9jsv node_version: "1.17" version_info: current_version: "1.17" maintenance_policy: auto_upgrade: true auto_repair: true maintenance_window: anytime: {} node_labels: apps/tier: backend environment: production
- In the management console
-
Get information about the created group of labeled nodes:
Management consoleCLI- In the management console
, select the folder where the Kubernetes cluster was created. - In the list of services, select Managed Service for Kubernetes.
- Select the Kubernetes cluster where the node group was created.
- On the Kubernetes cluster page, go to Nodes manager.
- On one of the node pages, go to the Labels tab. The tab lists the node's system and user labels.
- View all the nodes in a Kubernetes cluster:
kubectl get nodes
Command result:
NAME STATUS ROLES AGE VERSION catkuapro07enihqmk51-hgjd Ready <none> 1h v1.17.8 catkuapro07enihqmk51-lskc Ready <none> 1h v1.17.8
- Get information on a selected Kubernetes cluster node:
kubectl describe node catkuapro07enihqmk51-hgjd
Command result:
Name: catkuapro07enihqmk51-hgjd Roles: <none> Labels: apps/tier=backend beta.kubernetes.io/arch=amd64 beta.kubernetes.io/instance-type=standard-v2 ...
- In the management console