Prerequisites
If you use the web console, you don’t need to complete any prerequisites.- CLI
- Go SDK
- Python SDK
- JavaScript SDK
How to set a Kubernetes version
- Web console
- CLI
- Go SDK
- Python SDK
- JavaScript SDK
- In the sidebar, go to
Compute → Kubernetes.
- Click
Create cluster.
- In the Control plane section, select the Kubernetes version from the drop-down list.
It is not currently possible to set a Kubernetes version for a node group in the web console.
Use the following parameters:
-
For clusters (nebius mk8s cluster create):
--control-plane-version <major.minor> -
For node groups (nebius mk8s node-group create):
--version <major.minor>The Kubernetes version for a node group must not be higher than for the control plane.
Set the following parameters when creating a cluster or node group:
-
For clusters, in
mk8s.CreateClusterRequest, setSpec.ControlPlane.Versionto<major.minor>. -
For node groups, in
mk8s.CreateNodeGroupRequest, setSpec.Versionto<major.minor>.The Kubernetes version for a node group must not be higher than for the control plane.
Set the following parameters when creating a cluster or node group:
-
For clusters, in
CreateClusterRequest, setspec.control_plane.versionto<major.minor>. -
For node groups, in
CreateNodeGroupRequest, setspec.versionto<major.minor>.The Kubernetes version for a node group must not be higher than for the control plane.
Set the following parameters when creating a cluster or node group:
-
For clusters, in
CreateClusterRequest, setspec.controlPlane.versionto<major.minor>. -
For node groups, in
CreateNodeGroupRequest, setspec.versionto<major.minor>.The Kubernetes version for a node group must not be higher than for the control plane.
How to upgrade a Kubernetes version
To upgrade a Managed Kubernetes cluster to a new version, upgrade the control plane first and then the node groups.The Kubernetes version for a node group must not be higher than for the control plane.
- CLI
- Go SDK
- Python SDK
- JavaScript SDK
-
Get the ID of the cluster:
nebius mk8s cluster get-by-name \ --name <cluster_name> --format jsonpath='{.metadata.id}' -
Upgrade the control plane:
nebius mk8s cluster update \ --id <cluster_ID> \ --control-plane-version <major.minor> -
After the upgrade is completed, get the ID of the node group:
nebius mk8s node-group get-by-name \ --parent-id <cluster_ID> \ --name <node_group_name> --format jsonpath='{.metadata.id}' -
Upgrade the node group:
nebius mk8s node-group update \ --id <node_group_ID> \ --version <major.minor>
-
Get the ID of the cluster:
clusterByName, err := sdk.Services().MK8S().V1(). Cluster().GetByName( ctx, &common.GetByNameRequest{ Name: "<cluster_name>", }, ) if err != nil { return err } clusterByNameID := clusterByName.GetMetadata().GetId() if clusterByNameID == "" { return errors.New("cluster ID is missing") } fmt.Println(clusterByNameID) -
Upgrade the control plane. Set the new version in
Spec.ControlPlane.Version:cluster, err := sdk.Services().MK8S().V1(). Cluster().Get( ctx, &mk8s.GetClusterRequest{ Id: "<cluster_ID>", }, ) if err != nil { return err } clusterSpec := cluster.GetSpec() if clusterSpec == nil || clusterSpec.GetControlPlane() == nil { return errors.New("cluster control plane spec is missing") } clusterSpec.GetControlPlane().Version = "<major.minor>" clusterOperation, err := sdk.Services().MK8S().V1(). Cluster().Update( ctx, &mk8s.UpdateClusterRequest{ Metadata: cluster.GetMetadata(), Spec: clusterSpec, }, ) if err != nil { return err } if _, err = clusterOperation.Wait(ctx); err != nil { return err } -
After the upgrade is completed, get the ID of the node group:
nodeGroupByName, err := sdk.Services().MK8S().V1(). NodeGroup().GetByName( ctx, &common.GetByNameRequest{ ParentId: "<cluster_ID>", Name: "<node_group_name>", }, ) if err != nil { return err } nodeGroupByNameID := nodeGroupByName.GetMetadata().GetId() if nodeGroupByNameID == "" { return errors.New("node group ID is missing") } fmt.Println(nodeGroupByNameID) -
Upgrade the node group. Set the new version in
Spec.Version:nodeGroup, err := sdk.Services().MK8S().V1(). NodeGroup().Get( ctx, &mk8s.GetNodeGroupRequest{ Id: "<node_group_ID>", }, ) if err != nil { return err } nodeGroupSpec := nodeGroup.GetSpec() if nodeGroupSpec == nil { return errors.New("node group spec is missing") } nodeGroupSpec.Version = "<major.minor>" nodeGroupOperation, err := sdk.Services().MK8S().V1(). NodeGroup().Update( ctx, &mk8s.UpdateNodeGroupRequest{ Metadata: nodeGroup.GetMetadata(), Spec: nodeGroupSpec, }, ) if err != nil { return err } if _, err = nodeGroupOperation.Wait(ctx); err != nil { return err }
-
Get the ID of the cluster:
cluster_service = ClusterServiceClient(sdk) cluster_by_name = await cluster_service.get_by_name( GetByNameRequest(name="<cluster_name>"), ) cluster_by_name_id = cluster_by_name.metadata.id print(cluster_by_name_id) -
Upgrade the control plane. Set the new version in
spec.control_plane.version:cluster_service = ClusterServiceClient(sdk) cluster = await cluster_service.get( GetClusterRequest(id="<cluster_ID>"), ) if cluster.spec is None or cluster.spec.control_plane is None: raise ValueError("cluster control plane spec is missing") cluster.spec.control_plane.version = "<major.minor>" cluster_operation = await cluster_service.update( UpdateClusterRequest( metadata=cluster.metadata, spec=cluster.spec, ), ) await cluster_operation.wait() -
After the upgrade is completed, get the ID of the node group:
node_group_service = NodeGroupServiceClient(sdk) node_group_by_name = await node_group_service.get_by_name( GetByNameRequest( parent_id="<cluster_ID>", name="<node_group_name>", ), ) node_group_by_name_id = node_group_by_name.metadata.id print(node_group_by_name_id) -
Upgrade the node group. Set the new version in
spec.version:node_group_service = NodeGroupServiceClient(sdk) node_group = await node_group_service.get( GetNodeGroupRequest(id="<node_group_ID>"), ) if node_group.spec is None: raise ValueError("node group spec is missing") node_group.spec.version = "<major.minor>" node_group_operation = await node_group_service.update( UpdateNodeGroupRequest( metadata=node_group.metadata, spec=node_group.spec, ), ) await node_group_operation.wait()
-
Get the ID of the cluster:
const clusterLookupService = new ClusterService(sdk); const clusterByName = await clusterLookupService.getByName( GetByNameRequest.create({ name: "<cluster_name>", }), ); const clusterByNameId = clusterByName.metadata?.id; if (!clusterByNameId) { throw new Error("cluster ID is missing"); } console.log(clusterByNameId); -
Upgrade the control plane. Set the new version in
spec.controlPlane.version:const clusterService = new ClusterService(sdk); const cluster = await clusterService.get( GetClusterRequest.create({ id: "<cluster_ID>", }), ); if (!cluster.spec?.controlPlane) { throw new Error("cluster control plane spec is missing"); } cluster.spec.controlPlane.version = "<major.minor>"; const clusterOperation = await clusterService.update( UpdateClusterRequest.create({ metadata: cluster.metadata, spec: cluster.spec, }), ).result; await clusterOperation.wait(); -
After the upgrade is completed, get the ID of the node group:
const nodeGroupLookupService = new NodeGroupService(sdk); const nodeGroupByName = await nodeGroupLookupService.getByName( GetByNameRequest.create({ parentId: "<cluster_ID>", name: "<node_group_name>", }), ); const nodeGroupByNameId = nodeGroupByName.metadata?.id; if (!nodeGroupByNameId) { throw new Error("node group ID is missing"); } console.log(nodeGroupByNameId); -
Upgrade the node group. Set the new version in
spec.version:const nodeGroupService = new NodeGroupService(sdk); const nodeGroup = await nodeGroupService.get( GetNodeGroupRequest.create({ id: "<node_group_ID>", }), ); if (!nodeGroup.spec) { throw new Error("node group spec is missing"); } nodeGroup.spec.version = "<major.minor>"; const nodeGroupOperation = await nodeGroupService.update( UpdateNodeGroupRequest.create({ metadata: nodeGroup.metadata, spec: nodeGroup.spec, }), ).result; await nodeGroupOperation.wait();