mk8s — Managed Service for Kubernetes
Module:
services/mk8s· Image:nebius-mocker-mk8s·NEBIUS_MOCKER_SERVICES=mk8sM1 tier: T2 (mockbackend) · T3:k3sbackend (real Kubernetes in Docker) · Endpoint:mk8s.api.nebius.cloud
Implementation status
| Piece | Status |
|---|---|
nebius.mk8s.v1.ClusterService: Create, Get, GetByName, List (paged), Update (reset mask, resource_version), Delete, ListControlPlaneVersions |
✅ T2 |
nebius.mk8s.v1.NodeGroupService: Create, Get, GetByName, List (paged), Update (reset mask, resource_version), Delete, Upgrade, PreflightCheck, GetCompatibilityMatrix |
✅ T2 |
nebius.mk8s.v1alpha1.ClusterService and NodeGroupService (deprecated): every RPC, as a second view of the same stored v1 resources (same IDs; common.v1alpha1 operations) |
✅ T2 |
Node instances: every node of a node group is an ordinary compute instance (RUNNING, boot disk named <node>-boot), visible in InstanceService.Get/List; user updates, start, stop and delete are refused with FAILED_PRECONDITION |
✅ |
Backend port (domain.Backend in services/mk8s/domain/ports.go); mock is the default |
✅ |
| Control-plane version catalog, node group version skew, node image compatibility matrix | ✅ |
NodeGroupService.PreflightCheck (create, update, recreate, delete; unknown_paths; paths_require_recreate) |
✅ |
| Defaults filled like the service (control-plane subnet, etcd size, node boot disk, network interface subnet, deployment strategy) | ✅ |
Status counts (node_count, ready_node_count, target_node_count, outdated_node_count), not-ready nodes reported honestly |
✅ |
| Cluster delete cascades: node groups and their node instances, Applications releases, the VPC network binding | ✅ |
nebius mk8s cluster get-credentials kubeconfig and the get-token exec plugin |
✅ e2e: test/cli/mk8s (with the mock backend nothing serves the Kubernetes API) |
Authorization: rules for every RPC (mk8s.clusters.*, mk8s.nodeGroups.*); viewers read clusters, node groups and node instances |
✅ |
nebius_mk8s_v1_{cluster,node_group} and nebius_mk8s_v1alpha1_{cluster,node_group} resources and data sources with the official provider |
✅ e2e: test/terraform/mk8s |
A working Kubernetes API: k3s backend (a k3s server per cluster, a k3s agent per node, bounded by the Docker host), Nebius IAM tokens through a TokenReview webhook mapped to nebius:viewer/editor/admin, GPU capacity |
✅ e2e: test/mk8s (make e2e-mk8s), see k3s backend |
Rolling node replacement in batches that honour strategy (max_surge, max_unavailable), progress in status |
✅ |
template.max_pods (8–256, default 110): stored and echoed, a change rolls the nodes out; the k3s backend runs each kubelet with it |
✅ e2e: test/terraform/mk8s, make e2e-mk8s |
Quotas: mk8s.cluster.count on cluster Create; node group Create and scale-up are checked against the compute quotas of the nodes they add (instances, vCPUs or GPUs, boot disks), synchronously; each node is then charged by compute (quotas.md) |
✅ contract: test/contract/quotas_compute_test.go |
| Audit logs, Karpenter, OIDC, NVLink, reservations, local disks, spot, auto-repair conditions, container runtime | Not yet (see Not yet) |
Verified against: nebius/api@4522189, terraform-provider-nebius v0.6.91, gosdk v0.2.100, nebius CLI 0.12.312.
Covered by unit tests (services/mk8s/{domain,dal,api,backend/mock}, services/compute/domain/nodes_test.go), gosdk
contract tests (test/contract/mk8s_*), the Terraform e2e suite
(test/terraform/mk8s) and the CLI e2e suite (test/cli/mk8s), all run by make e2e; the k3s backend by its unit tests (services/mk8s/backend/k3s, pkg/dockerhost,
services/iam/{domain,api}/k8swebhook_test.go) and make e2e-mk8s.
| Resource kind | Message | NID prefix | Parent | States |
|---|---|---|---|---|
| Cluster | mk8s.v1.Cluster |
mk8scluster |
project | PROVISIONING, RUNNING, DELETING (+ reconciling) |
| Node group | mk8s.v1.NodeGroup |
mk8snodegroup |
cluster | PROVISIONING, RUNNING, DELETING (+ reconciling) |
Behavior notes
These follow docs.nebius.com/kubernetes and the protos. Where neither says what happens, the mock’s choice is marked (mock).
Clusters
- Create is an operation: the cluster is stored
PROVISIONING(reconciling = true) and the backend creates the control plane; it then becomesRUNNINGwithstatus.control_plane.endpoints, the cluster CA inauth.cluster_ca_certificateandversion(<major>.<minor>.<patch>-nebius-cp.1). A failed backend call leaves the clusterPROVISIONINGwith anERRORevent and fails the operation. - Defaults (the service fills them, so
terraform planstays empty):control_plane.subnet_idis the project’s default subnet when unset (INVALID_ARGUMENTif the project has none);etcd_cluster_size3;versionthe newest catalog version. The subnet must exist and be in the cluster’s project. The cluster binds its VPC network, so the network cannot be deleted under it; the binding is released at cluster delete even when the subnet was deleted first.subnet_idandkube_network.service_cidrsare immutable (an empty value on update keeps the stored one). - Service CIDRs. A
kube_network.service_cidrsCIDR that overlaps the private CIDRs of the cluster’s VPC network (its private pools and the subnet’s own) isINVALID_ARGUMENTnamingspec.kube_network.service_cidrs[0]. A bare prefix length (/16, the default) is allocated by the service and cannot overlap. - Versions.
control_plane.versionmust be in the catalog (NEBIUS_MOCKER_MK8S_VERSIONS, default1.34,1.35,1.36, the versions the Nebius docs list;ListControlPlaneVersionsreturns the catalog). An update can keep the version or raise it by one minor; skipping a minor or a downgrade isINVALID_ARGUMENT. The backend must also support the version (Backend.CheckVersion). - Endpoints (mock): with the
mockbackend the private endpoint ishttps://<cluster-id>.private.mk8s.mocker.localhostand, whenendpoints.public_endpointis set, the public one ishttps://<cluster-id>.mk8s.mocker.localhost..localhostnames resolve to the loopback address and nothing listens: useNEBIUS_MOCKER_MK8S_BACKEND=k3sfor a working Kubernetes API. The CA is a per-cluster self-signed certificate, stable for the process. The real endpoint and CA formats are undocumented. - Delete sets
DELETING, then deletes every node group (and its node instances), the cluster’s Applications releases, the backend control plane and the network binding. - Update with nothing changed keeps
resource_versionandupdated_at.
Node groups
- Create needs a
RUNNINGcluster (FAILED_PRECONDITIONotherwise) and a name unique in the cluster. The group is storedPROVISIONING; the operation creates the node instances, hands them to the backend and setsRUNNING.target_node_countisfixed_node_count, orautoscaling.initial_node_count(defaultmin_node_count).node_count,ready_node_countandoutdated_node_countfollow what exists and what the backend reports ready. - Defaults: boot disk
NETWORK_SSD, 128 GiB; one network interface in the cluster’s subnet;osubuntu24.04;versionthe cluster’s minor with the latest node image (-nebius-node.1); strategymax_unavailable1,max_surge0,drain_timeout10m, reported instatus.strategy(both 0 isINVALID_ARGUMENT). - Validation.
template.resourcesmust be a platform and preset of the compute catalog; the (platform, OS, drivers preset) triple must be a node image of the compatibility matrix; node subnets must be in the cluster’s network; boot disk, security groups, filesystems, GPU cluster and service account go through the compute instance checks, with violations renamed to the node template’s field names. - Version skew. A node group version must be in the catalog, not newer than the cluster and at most 2 minors behind
it (
spec.versionaccepts1.35or1.35-nebius-node.1; node image numbers above 1 do not exist). A cluster upgrade does not move a node group whosespec.versionis empty.GetCompatibilityMatrix(cluster_kubernetes_version[, platform])returns the node group versions allowed for that cluster version and their images:ubuntu24.04andubuntu22.04driverless on CPU and GPU platforms,cuda12on GPU platforms,cuda12.8on Blackwell platforms (mock: the images are the mock’s reading of the docs, the same for every minor). - Update scales the group (the fixed count, or the current count clamped to the autoscaling bounds) and rolls the
nodes out when the template or the version changes.
taintsandmetadata(the Kubernetes node labels) do not roll out, as the proto says.template.max_podsis a template field like any other: setting, changing or unsetting it rolls the nodes out, and the provider plans it as an in-place update (noRequiresReplace).Upgrademoves the group to the latest node image and the cluster’s patch version, rolling its nodes out; it does nothing when the group is already there. - Rollouts replace the outdated nodes in batches, like a Kubernetes rolling update, per
status.strategy: up tomax_surgenew nodes above the target are added first (a percentage rounds up), and old nodes are removed while at least target −max_unavailablenodes are ready (a percentage rounds down; both 0 after rounding allows one unavailable node). Each batch creates the new compute instances, hands the node set to the backend, takes the removed nodes out of the backend and only then deletes their instances, and recordsnode_count,ready_node_countandoutdated_node_count(counting down;reconcilingis true). Batches areNEBIUS_MOCKER_MK8S_ROLLOUT_STEPapart on the mocker’s clock (default 0: one after the other); with a step, the operation runs detached and finishes with the last batch. A rollout that can neither add nor remove a node (new nodes never get ready) fails after ten checks, leaving the counts as they are.NodeGroupStatushas no progress tracker field; the counts are the progress. max_podsmust be 8–256 (buf.validate,InvalidArgumentnamingmax_pods). Unset (0) means the service default of 110 pods per node; like the service, the spec keeps 0 (the field is notNON_EMPTY_DEFAULTand the provider attribute is not computed) andNodeGroupStatushas no field for it. It reaches the backend asBackendNodeGroup.MaxPods; themockbackend runs no kubelet, so there is nothing to apply it to.- Draining (
drain_timeout): removed nodes leave the backend’s node set before their instances are deleted, andBackendNodeGroup.DrainTimeoutcarries the effectivestatus.strategy.drain_timeout(0: no limit), so a Kubernetes backend drains them insideEnsureNodes, bounded by it. Themockbackend runs no pods and has nothing to drain. - Delete sets
DELETING, deletes the node instances and empties the group in the backend.
Node instances
Each node is a compute instance named <node group name>-<5 characters>, in the cluster’s project, created RUNNING
without a visible operation, with a managed boot disk. Labels (mock names: the real label keys are undocumented):
| Label | Value |
|---|---|
mk8s.nebius.ai/cluster-id |
cluster ID |
mk8s.nebius.ai/node-group-id |
node group ID |
mk8s.nebius.ai/node-group-name |
node group name |
They win over template.instance_metadata.labels. The same three labels go on the Kubernetes Nodes, with
template.metadata.labels (keys containing kubernetes.io or k8s.io are dropped, per the proto). Users cannot Update,
Start, Stop or Delete a node instance: those fail with FAILED_PRECONDITION, “… is a node of mk8s node group …: change
the node group instead”.
Credentials
nebius mk8s cluster get-credentials --id <id> --external|--internal writes the kubeconfig Nebius writes: cluster,
context and user named nebius-mk8s-<cluster name>-<ID suffix> (the cluster ID without mk8scluster-), server the public
(--external) or private (--internal) endpoint verbatim, the CA embedded, and an exec plugin
(client.authentication.k8s.io/v1beta1) that runs nebius mk8s v1 cluster get-token --profile <profile> --format json.
get-token returns an IAM token from the mock. With the k3s backend that kubeconfig works with kubectl as is
(how); with the mock backend kubectl cannot connect: the endpoint resolves to
loopback and nothing listens. test/cli/mk8s checks the kubeconfig and runs the exec command as kubectl would.
Backends
domain.Backend (services/mk8s/domain/ports.go) is the Kubernetes data plane: CheckVersion, EnsureCluster,
DeleteCluster, EnsureNodes, Close. The control plane (resources, validation, operations, node instances) is the
mock’s; a backend only runs Kubernetes. Calls come from operation work, never inside a store transaction, one at a time
per cluster; every method is idempotent. EnsureNodes reports each node’s readiness: a node the backend cannot run is
not ready, with a reason, instead of an error, so the group honestly shows node_count > ready_node_count,
reconciling = true and a WARN event NodesNotReady. A failed reconciliation records an ERROR event
(ReconciliationFailed) and fails the operation.
NEBIUS_MOCKER_MK8S_BACKEND |
Behavior |
|---|---|
mock (default) |
No Kubernetes. Endpoints that resolve to loopback, a self-signed CA, every node ready at once. Operations do their work inside the request |
k3s |
A real k3s cluster per cluster and a k3s agent container per node, in Docker (k3s backend) |
Every backend but mock starts containers, so its operations run detached: Create, Update and Delete return the
operation at once and the work finishes on its own goroutine (pkg/operations, Detached) while clients poll it.
Preflight check
NodeGroupService.PreflightCheck runs the validation of Create or Update in dry-run mode and returns diagnostics
(ERROR, with the field path) instead of failing, whatever the problem (unknown cluster, bad version, unknown platform,
unimplemented field, duplicate name). context.action is CREATE, RECREATE, UPDATE or DELETE (nothing to check);
unspecified means UPDATE when metadata.id is set, else CREATE. context.unknown_paths (a Nebius mask) skips the
checks of values Terraform does not know yet. An UPDATE that changes an immutable path (metadata.parent_id,
template.nvlink.nvl_instance_group_id) returns it in paths_require_recreate and is evaluated as a recreate. An update
preflight is a patch with the request’s reset mask, like the Update it previews. The provider calls it on every plan.
Fields rejected as not implemented
A field the mock cannot honor is INVALID_ARGUMENT, “… is not implemented in NebiusMocker yet”, naming the path, on
Create, Update and PreflightCheck. Nothing is silently ignored:
- Cluster:
spec.control_plane.audit_logs,spec.control_plane.karpenter,spec.control_plane.authentication.oidc. - Node group, under
spec.template.:nvlink,reservation_policy(anything butAUTOwith no reservation IDs),local_disks,spot_pricing_policy,follows_spot_price,container_runtime.soci_pull_mode,gpu_settings.dra; andspec.auto_repair.conditions.
Operations and errors
common.v1.Operationfor v1,common.v1alpha1.Operationfor v1alpha1. Operations complete at once (or afterNEBIUS_MOCKER_OP_DELAY); only a detached backend defers the work.- An Update whose
resource_versiondoes not match isFAILED_PRECONDITION, and so is updating or upgrading something that is being deleted. - v1alpha1 is a field-number-compatible subset of v1, so requests are converted by a protobuf round trip and no input field is dropped. v1-only output fields are absent from v1alpha1 responses.
Authorization
Every RPC has a rule: mk8s.clusters.{get,list,create,update,delete} on the cluster (or its project) and
mk8s.nodeGroups.* on the node group (or its cluster). NodeGroupService.Upgrade needs mk8s.nodeGroups.update.
ListControlPlaneVersions and GetCompatibilityMatrix are open to any authenticated principal, and so is a
PreflightCheck with neither an ID nor a parent (Terraform planning a node group whose cluster does not exist yet);
otherwise it needs mk8s.nodeGroups.get on the node group or its cluster. v1alpha1 uses the same permissions. viewer
reads clusters, node groups, the catalog, preflight results and the node instances, and is PERMISSION_DENIED on every
write (test/contract/mk8s_authz_test.go).
Not yet
- Quota pre-checks for surge nodes of a rolling update (each surge node is still charged by compute when created).
- Audit logs, Karpenter and OIDC authentication; NVLink, capacity reservations, local disks, spot pricing, SOCI pull mode and DRA (all rejected, see above).
- Auto-repair: the setting is stored, but nodes never fail in the mock, so nothing is repaired (like compute’s
recovery_policy);auto_repair.conditionsis rejected. - Real node images and GPU drivers: nodes are management-plane compute instances (no VM boots), and Kubernetes nodes exist only with a Kubernetes backend.
- k3s backend:
public_endpoint.allowed_cidrsis rejected,etcd_cluster_size3 runs one server, and the mocker must run on the Docker host (it reaches each API server on its published port).
Terraform
All four resources and data sources run against the real provider in test/terraform/mk8s: create, an empty plan, an
in-place update, another empty plan, a template change that rolls every node instance out in batches, replacement on
immutable attributes, and destroy, plus a viewer that can read but
not create.
| Kind | Terraform type | Service | RPCs called | Tested |
|---|---|---|---|---|
| Resource | nebius_mk8s_v1_cluster |
nebius.mk8s.v1.ClusterService |
Get, GetByName, Create, Update, Delete + OperationService.Get | ✅ |
| Resource | nebius_mk8s_v1_node_group |
nebius.mk8s.v1.NodeGroupService |
Get, GetByName, Create, Update, Delete, PreflightCheck + OperationService.Get | ✅ |
| Resource | nebius_mk8s_v1alpha1_cluster |
nebius.mk8s.v1alpha1.ClusterService |
Get, GetByName, Create, Update, Delete + OperationService.Get | ✅ |
| Resource | nebius_mk8s_v1alpha1_node_group |
nebius.mk8s.v1alpha1.NodeGroupService |
Get, GetByName, Create, Update, Delete + OperationService.Get | ✅ |
| Data source | nebius_mk8s_v1_cluster |
nebius.mk8s.v1.ClusterService |
Get, GetByName | ✅ |
| Data source | nebius_mk8s_v1_node_group |
nebius.mk8s.v1.NodeGroupService |
Get, GetByName | ✅ |
| Data source | nebius_mk8s_v1alpha1_cluster |
nebius.mk8s.v1alpha1.ClusterService |
Get, GetByName | ✅ |
| Data source | nebius_mk8s_v1alpha1_node_group |
nebius.mk8s.v1alpha1.NodeGroupService |
Get, GetByName | ✅ |
The provider has no kubeconfig resource: build a kubeconfig from status.control_plane.endpoints and
auth.cluster_ca_certificate, or run nebius mk8s cluster get-credentials.
CLI
test/cli/mk8s runs the official nebius CLI through the flows of docs.nebius.com/kubernetes: mk8s cluster
list-control-plane-versions, create (public endpoint), get-by-name, get-credentials and the get-token exec
command; mk8s node-group create (fixed node count, platform and preset), get-compatibility-matrix, update, upgrade,
list and delete; the node instances in compute instance list, with compute instance delete and stop refused
(FailedPrecondition); a viewer that reads but cannot delete (PermissionDenied); and the Applications release
commands (see applications.md).
Configuration
| Env | Default | Description |
|---|---|---|
NEBIUS_MOCKER_MK8S_BACKEND |
mock |
mock | k3s (needs Docker; fails at startup, naming the setting, without it) |
NEBIUS_MOCKER_MK8S_ROLLOUT_STEP |
0 |
Pause between the batches of a node group rollout, on the mocker’s clock |
NEBIUS_MOCKER_MK8S_K3S_* |
k3s backend: Docker host, images per version, endpoint host, webhook URL, capacity estimates and limits, start timeout (configuration) | |
NEBIUS_MOCKER_MK8S_VERSIONS |
1.34,1.35,1.36 |
Control-plane version catalog, <major>.<minor>, comma-separated; the newest is the default for new clusters |
k3s backend: real Kubernetes
NEBIUS_MOCKER_MK8S_BACKEND=k3s gives every mk8s cluster a real Kubernetes API, the way LocalStack runs EKS
(MANAGED_K8S_PROVIDER, one k3s container per cluster). The mock still owns the control plane (resources, validation,
operations, nodes as compute instances); services/mk8s/backend/k3s runs Kubernetes on the local Docker host through
the Docker Engine API (pkg/dockerhost, no k3d binary):
| mk8s | Docker | Kubernetes |
|---|---|---|
| Cluster | rancher/k3s:<tag> server container nebius-mocker-<cluster id>-server (+ network and data volume of the same name) |
API server, no kubelet (--disable-agent: like Nebius, the control plane is not a node) |
| Node group node | k3s agent container nebius-mocker-<cluster id>-<node name> |
Node named after the node’s compute instance, with the group’s labels and taints |
- Version.
control_plane.versionpicks the image (NEBIUS_MOCKER_MK8S_K3S_IMAGES, defaults for 1.33–1.37).status.control_plane.versionreports the running Kubernetes patch. An upgrade replaces the server container on the same data volume and port; node group version changes recreate the agents. - Endpoint and CA. The API port is published on
NEBIUS_MOCKER_MK8S_K3S_BIND_IP(127.0.0.1).public_endpointandprivate_endpointare bothhttps://<ENDPOINT_HOST>:<port>(one network: the private endpoint is the same local address).cluster_ca_certificateis the k3s server CA, and the server certificate coversENDPOINT_HOST, so the kubeconfignebius mk8s cluster get-credentialswrites works as is. - Service CIDR.
kube_network.service_cidrs[0]becomes--service-cidr(/Nis carved from10.43.0.0). - Not applied:
public_endpoint.allowed_cidrsis rejected (InvalidArgument): every client of a local API server comes through the Docker host.etcd_cluster_size3 runs one k3s server (embedded datastore): control-plane HA is not emulated (it is not observable through the Kubernetes API;statusstill reports the size). - Approximated: a Node’s
cpuandmemorycapacity are the Docker host’s (the kubelet reads the host), not the preset’s; the authoritative preset is the node’s compute instance and the node group spec.nvidia.com/gpuis the preset’s GPU count. - Drain. Before a node’s agent is removed (scale-down, a rollout batch, a recreated agent), the node is drained like
kubectl drain --ignore-daemonsets --delete-emptydir-data: cordoned, then its pods evicted through the Eviction API, which honours PodDisruptionBudgets (refused evictions are retried). The node group’sstrategy.drain_timeoutbounds it (0: no limit, so a PodDisruptionBudget that never allows an eviction blocks, as the provider documents); when it runs out, the pods left are deleted and the node removed. Within one call new (surge) nodes start before old ones are drained, so evicted pods have somewhere to go. Deleting a node group (or its cluster) drains its nodes the same way. - Template labels and taints are applied to the existing nodes in place (no rollout, as the service does): the
backend records the group’s labels and taints in Node annotations (
nebius-mocker/node-group-labels,nebius-mocker/node-group-taints), so ones the group drops are removed and labels or taints others added stay. A new version, a different GPU count or a differentmax_podsrecreates the agent. max_podsis passed to each agent as--kubelet-arg=max-pods=N(unset: no flag, the kubelet default 110, which is the MK8s default), so the Node’sstatus.capacity.podsandallocatable.podsare N. A change reaches the nodes the way Nebius applies it, through a rollout: new nodes start with the new limit. Approximated: MK8s sizes each node’s pod CIDR frommax_pods(32 - ceil(log2(2 * max_pods))); k3s gives every node a/24from10.42.0.0/16, so a limit above 254 pods is bounded by the node’s pod IPs.- Nodes are node-group nodes only: the server runs with
--disable-agent, sokubectl get nodeslists exactly the node groups’ compute instances, by name, and DaemonSets count only them.
Authentication: Nebius IAM tokens, documented groups
The kubeconfig from get-credentials runs nebius mk8s v1 cluster get-token --profile <p> --format json, which prints
the profile’s IAM access token. Each k3s API server is started with webhook token authentication pointing at the mocker
(POST /mk8s/v1/clusters/<id>/tokenreview on the edge port, NEBIUS_MOCKER_MK8S_K3S_WEBHOOK_URL). The webhook accepts
every token the gRPC edge accepts (dev tokens, tokens exchanged for service-account keys or federated credentials) and
answers with:
- username and uid: the principal ID (
tenantuseraccount-…,serviceaccount-…); - one group, by the highest IAM role the principal holds on the cluster or its project/tenant:
nebius:admin(admin),nebius:editor(editor),nebius:viewer(viewer), none otherwise.
Nebius documents these groups (OIDC providers:
“users who access the cluster with Nebius AI Cloud credentials … are in groups such as nebius:viewer,
nebius:editor, and nebius:admin, and these groups already have permissions in the cluster”). The exact bindings are
not documented; the mock installs ClusterRoleBindings nebius:viewer → view, nebius:editor → edit,
nebius:admin → cluster-admin, plus nebius:node-reader (get, list, watch Nodes, which view and edit do not cover) for viewers and editors. So a viewer service account can list pods but not create them. Bind your own roles to
these groups, or to the user names, for anything finer. Under NEBIUS_MOCKER_AUTHZ=off and audit (the default) every
valid token gets nebius:admin (audit logs the group it would get), as the gRPC edge never blocks in those modes.
Nodes: bounded by the machine
Each node of a node group is one agent container, admitted while the Docker host fits it: at most
NCPU / NEBIUS_MOCKER_MK8S_K3S_AGENT_CPU agents, free memory (docker info MemTotal minus what running containers use,
this backend’s containers counted at least at their estimate) above _MEMORY_RESERVE plus _AGENT_MEMORY, and
_MAX_AGENTS if set. A node that does not fit is never faked: it stays not ready, ready_node_count < node_count, and
the node group status names the limit (for example “Docker host capacity: 3 of 3 k3s agents are running
(NEBIUS_MOCKER_MK8S_K3S_MAX_AGENTS)”). Agents that exit or do not join within _START_TIMEOUT are reported the same
way, with their last log lines.
GPU presets: there are no GPUs, but each node of a GPU preset advertises the preset’s GPU count as the extended resource
nvidia.com/gpu (what the NVIDIA device plugin reports), so pods requesting GPUs and GPU DaemonSets schedule on them.
Nothing runs on a GPU.
Lifecycle
Every container, network and volume carries nebius-mocker.backend=k3s, nebius-mocker.cluster=<id>,
nebius-mocker.owner=<webhook URL> (the mocker that made it) and, for agents, nebius-mocker.node-group,
nebius-mocker.node and nebius-mocker.instance. They are removed when their cluster, node group or node goes, when
the mocker shuts down, and at startup (leftovers of a killed mocker on the same port: LocalStack’s orphan problem). A
mocker only reaps its own owner’s objects, so two mockers can share a Docker host; deploy/k3s/reap.sh removes objects
whose owner port no longer answers. A cluster stays PROVISIONING until its API server answers /readyz; a server that exits or does not
get ready within _START_TIMEOUT fails the operation with FAILED_PRECONDITION and the server’s last log lines.
With the k3s backend and no reachable Docker daemon the mocker refuses to start and names the setting.
Using it from your machine
The kubeconfig’s exec plugin runs the nebius CLI without --insecure, and a profile cannot store that flag, so the
mocker must serve TLS from a CA your machine trusts (as for the registry credential helper):
- A certificate for
api.nebius.cloud,*.api.nebius.cloudand*.iam.api.nebius.cloud(pluslocalhost), issued by a local CA (mkcertworks). Trust the CA: macOS Keychain (security add-trusted-cert, ormkcert -install); Linux/usr/local/share/ca-certificates+update-ca-certificates. - Resolve the API names to the mocker:
/etc/hostslines127.0.0.1 api.nebius.cloud cpl.iam.api.nebius.cloud tokens.iam.api.nebius.cloud mk8s.api.nebius.cloud compute.api.nebius.cloud vpc.api.nebius.cloud. - Start the mocker:
NEBIUS_MOCKER_MK8S_BACKEND=k3s NEBIUS_MOCKER_AUTHZ=enforce \ NEBIUS_MOCKER_TLS_CERT_FILE=tls.crt NEBIUS_MOCKER_TLS_KEY_FILE=tls.key make run nebius profile create mocker --endpoint api.nebius.cloud:4566 --token-file token --parent-id <project>, create the cluster and a node group (Terraform:address_options = { "*" = { no_tls_verify = true } }or trust the CA), thennebius mk8s cluster get-credentials --id <cluster> --externaland usekubectl.
Terraform’s provider can use no_tls_verify = true instead of trusting the CA.
- Docker Desktop (macOS, Windows): works as above. The API servers reach the mocker as
host.docker.internal. - Linux (Docker Engine): containers reach the host through the bridge gateway, not loopback. Bind the mocker on
an address the containers can reach (
NEBIUS_MOCKER_LISTEN=0.0.0.0:4566, or thedocker0address), and setNEBIUS_MOCKER_MK8S_K3S_WEBHOOK_URL=http(s)://<docker0 IP>:4566ifhost.docker.internalis not what you want (the backend addshost.docker.internal:host-gatewayto every k3s container, Docker 20.10+). The API servers are published on127.0.0.1and reachable from the host as usual. - kubectl in a container: set
NEBIUS_MOCKER_MK8S_K3S_ENDPOINT_HOST=host.docker.internal(the certificate covers it) and give the container--add-hostentries for the API names →host-gateway.make e2e-mk8sruns this way. - The mocker must run on the Docker host (not in a container): it reaches each API server on its published port.
Tested by make e2e-mk8s (test/mk8s): Terraform creates a network, a cluster, a CPU node group (labels, a taint)
and a GPU node group; get-credentials and kubectl in a Linux user-machine container see the nodes (named after their
compute instances, labels, taints, nvidia.com/gpu); a Deployment rolls out, a DaemonSet lands on every node and a GPU pod
schedules on the GPU node; host kubectl with the editor token can create Deployments but not ClusterRoleBindings; a
viewer service account (key exchange from a CLI profile) is nebius:viewer, lists pods and cannot create; scaling past
NEBIUS_MOCKER_MK8S_K3S_MAX_AGENTS leaves nodes not ready with the reason, scaling down removes agents, nodes and
instances; a template label and taint change updates the node in place (a user’s own label stays); a preset change
rolls the group onto a new node, and the Deployment’s pods, under a PodDisruptionBudget, are evicted by their own
kubelet (drained) and rescheduled there before the old agent goes; terraform destroy leaves no container.
API surface
nebius.mk8s.v1.ClusterService
Endpoint: mk8s.api.nebius.cloud:443 · Proto: nebius/mk8s/v1/cluster_service.proto · used by Terraform
| RPC | Request | Response | TF |
|---|---|---|---|
Get |
GetClusterRequest |
Cluster |
✅ |
GetByName |
common.v1.GetByNameRequest |
Cluster |
✅ |
List |
ListClustersRequest |
ListClustersResponse |
|
Create |
CreateClusterRequest |
common.v1.Operation |
✅ |
Update |
UpdateClusterRequest |
common.v1.Operation |
✅ |
Delete |
DeleteClusterRequest |
common.v1.Operation |
✅ |
ListControlPlaneVersions |
ListClusterControlPlaneVersionsRequest |
ListClusterControlPlaneVersionsResponse |
nebius.mk8s.v1.NodeGroupService
Endpoint: mk8s.api.nebius.cloud:443 · Proto: nebius/mk8s/v1/node_group_service.proto · used by Terraform
| RPC | Request | Response | TF |
|---|---|---|---|
Get |
GetNodeGroupRequest |
NodeGroup |
✅ |
GetByName |
common.v1.GetByNameRequest |
NodeGroup |
✅ |
List |
ListNodeGroupsRequest |
ListNodeGroupsResponse |
|
Create |
CreateNodeGroupRequest |
common.v1.Operation |
✅ |
Update |
UpdateNodeGroupRequest |
common.v1.Operation |
✅ |
Delete |
DeleteNodeGroupRequest |
common.v1.Operation |
✅ |
Upgrade |
UpgradeNodeGroupRequest |
common.v1.Operation |
|
PreflightCheck |
PreflightCheckNodeGroupRequest |
PreflightCheckNodeGroupResponse |
✅ |
GetCompatibilityMatrix |
GetNodeGroupCompatibilityMatrixRequest |
NodeGroupCompatibilityMatrix |
nebius.mk8s.v1alpha1.ClusterService (deprecated)
Endpoint: mk8s.api.nebius.cloud:443 · Proto: nebius/mk8s/v1alpha1/cluster_service.proto · used by Terraform
| RPC | Request | Response | TF |
|---|---|---|---|
Get |
GetClusterRequest |
Cluster |
✅ |
GetByName |
GetClusterByNameRequest |
Cluster |
✅ |
List |
ListClustersRequest |
ListClustersResponse |
|
Create |
CreateClusterRequest |
common.v1alpha1.Operation |
✅ |
Update |
UpdateClusterRequest |
common.v1alpha1.Operation |
✅ |
Delete |
DeleteClusterRequest |
common.v1alpha1.Operation |
✅ |
ListControlPlaneVersions |
ListClusterControlPlaneVersionsRequest |
ListClusterControlPlaneVersionsResponse |
nebius.mk8s.v1alpha1.NodeGroupService (deprecated)
Endpoint: mk8s.api.nebius.cloud:443 · Proto: nebius/mk8s/v1alpha1/node_group_service.proto · used by Terraform
| RPC | Request | Response | TF |
|---|---|---|---|
Get |
GetNodeGroupRequest |
NodeGroup |
✅ |
GetByName |
GetNodeGroupByNameRequest |
NodeGroup |
✅ |
List |
ListNodeGroupsRequest |
ListNodeGroupsResponse |
|
Create |
CreateNodeGroupRequest |
common.v1alpha1.Operation |
✅ |
Update |
UpdateNodeGroupRequest |
common.v1alpha1.Operation |
✅ |
Delete |
DeleteNodeGroupRequest |
common.v1alpha1.Operation |
✅ |
Upgrade |
UpgradeNodeGroupRequest |
common.v1alpha1.Operation |