Technical Insight Explanation

Virtual Kubelet Internals: Architecture, Pod Lifecycle and Scheduling

Explore Virtual Kubelet internals, node registration, provider interfaces, Pod reconciliation, scheduling and operational failure domains.

Virtual Kubelet Internals: Architecture, Pod Lifecycle and Scheduling
On this page

A Kubernetes scheduler does not start containers. It assigns Pods to nodes. What happens after that is somebody else’s responsibility.

On a conventional worker, the kubelet observes assigned Pods and coordinates their execution through the container runtime, networking and storage integrations. Virtual Kubelet replaces that execution path with a provider interface. The scheduler still sees a Node object. Controllers still reconcile Pods. But the infrastructure executing those workloads may be somewhere else entirely.

The interesting question is how Virtual Kubelet preserves enough of the Kubernetes execution contract to make external infrastructure appear as a node.

Inside Virtual Kubelet

Virtual Kubelet is a Go framework for implementing kubelet-like integrations. It is not a container runtime, a scheduler or a serverless compute service. A provider implementation supplies the connection to an actual execution backend. The upstream framework separates two principal reconciliation responsibilities: the Node controller and the Pod controller. The former maintains the representation of the node in Kubernetes. The latter coordinates the lifecycle of assigned Pods with the provider.

Virtual Kubelet controllers and provider interfaces

These controllers communicate with the Kubernetes API rather than receiving direct execution commands from the scheduler. Informers and cached objects provide a view of Kubernetes state; work queues allow reconciliation to proceed independently of incoming API events. A provider may run inside an existing Kubernetes cluster or elsewhere, provided it has the necessary API connectivity and credentials. The virtual Node object does not describe the machine hosting the Virtual Kubelet process.

That distinction is important when reasoning about availability: the adapter and the workloads it manages can have entirely different failure domains.

Node registration, capacity and heartbeats

A virtual node participates in scheduling through an ordinary Kubernetes Node object. Its metadata and status expose labels, taints, capacity, allocatable resources and conditions. The integration configures these values to represent the backend’s capabilities. The Node controller maintains node status and can renew a Kubernetes Lease in the kube-node-lease namespace. Node-provider health checks and status notifications allow the integration to communicate changes in health.

But what does a healthy virtual node actually mean?

A functioning controller and a renewed Lease indicate that the node integration is communicating with Kubernetes. They do not necessarily prove that the external platform has enough quota, available IP addresses or immediate provisioning capacity for another workload.

Likewise, advertised allocatable CPU and memory are scheduling inputs, not a live reservation of external infrastructure. A provider must decide how to represent its capacity and enforce backend constraints. An excessively optimistic capacity advertisement can move failures from scheduling into provisioning.

The provider contract

The upstream node.PodLifecycleHandler interface defines the core operations for managing Pods. The following table summarizes the responsibilities rather than reproducing the complete Go signatures.

OperationResponsibility
CreatePodRequest creation of the external workload
UpdatePodReconcile supported changes to an existing workload
DeletePodRemove the corresponding external workload
GetPodRetrieve a provider-side representation of a Pod
GetPodStatusRetrieve observed execution status
GetPodsEnumerate workloads known to the provider

The framework also supports asynchronous Pod notifications through PodNotifier. Additional interfaces and integrations can expose logs, execution sessions and resource statistics, depending on the provider. The provider translates Kubernetes objects into backend-specific resources. Container images, environment variables, resource requests and restart policies must be mapped to whatever the backend supports. Secrets, ConfigMaps and volumes require particular attention: their existence in Kubernetes does not automatically make them accessible in another execution environment.

A robust implementation must also handle repeated operations safely. A network timeout after a successful backend creation request should not result in a second external workload when reconciliation retries the operation. Stable workload identity and idempotent backend operations are essential design properties.

Pod lifecycle and asynchronous reconciliation

Once a Pod is bound to a virtual node, the Pod controller observes the assignment and invokes the provider. Depending on the backend, creation may involve an asynchronous provisioning operation rather than immediate container execution.

Asynchronous Pod creation and status reconciliation

There are three distinct milestones: the Pod is scheduled, the backend accepts the creation request, and the workload becomes ready. None implies that the next has already occurred.

A provider must translate observed backend state into Kubernetes Pod status, including container states, conditions and Pod IP information where applicable. A Pod may remain Pending after successful scheduling while the external platform pulls images or allocates resources. Running does not necessarily mean Ready. Deletion introduces the reverse problem. Removing a Kubernetes Pod must eventually remove its corresponding external resources. If the backend API is unavailable, cleanup may be delayed. Depending on the implementation, forced deletion or failed reconciliation can leave orphaned resources that continue consuming quota or generating costs.

The controller is not merely forwarding API requests. It is maintaining consistency across two systems with independent state and failure modes.

Scheduling and resource accounting

The standard scheduler can place workloads on a virtual node without understanding its provider. It evaluates the Node object using the usual filtering and scoring mechanisms.

A platform team might expose a dedicated workload class using a label and taint. For example, assuming the virtual node has been configured with the corresponding label and NoSchedule taint, a Pod template could contain:

spec:
  nodeSelector:
    compute.example.com/class: virtual
  tolerations:
    - key: compute.example.com/virtual
      operator: Exists
      effect: NoSchedule
  containers:
    - name: worker
      image: busybox:1.37
      command: ["sh", "-c", "sleep 3600"]
      resources:
        requests:
          cpu: 250m
          memory: 128Mi

These are illustrative platform-defined labels, not universal Virtual Kubelet defaults. A toleration permits placement; the selector restricts it. Neither guarantees that the provider supports the requested workload.

The scheduler accounts for resource requests against advertised allocatable capacity. External quotas and backend-specific resource shapes may impose additional constraints that are invisible to the scheduler. Admission policies can reject unsupported workload configurations before they reach the provider.

Networking and service discovery

Creating a container remotely is only half the problem. Kubernetes applications expect network connectivity and service discovery.

For selector-based Services, Kubernetes normally derives EndpointSlices from matching Pods and their reported addresses and readiness. Reporting a Pod IP can therefore make an external workload discoverable, but it does not establish a route to that address. The provider integration must ensure that the required traffic paths actually exist. This may involve shared virtual networks, routing, tunnels or provider-specific networking mechanisms. DNS resolution, return traffic and network policy enforcement must also be validated.

A Pod can be Running while remaining unreachable from other workloads. Similarly, a NetworkPolicy enforced by the cluster CNI does not necessarily govern traffic inside an external backend. The Kubernetes API describes the intended connectivity. The execution environment determines whether that connectivity is implemented.

Failure domains and recovery

Virtual Kubelet introduces an additional control boundary between Kubernetes and the execution environment.

Virtual Kubelet operational failure domains

FailurePotential consequence
Virtual Kubelet process unavailableNode heartbeats and workload reconciliation may stop
Provider credentials expiredCreation, status retrieval or deletion may fail
Backend quota exhaustedBound Pods may fail to provision
Backend workload terminatedKubernetes status may lag until reconciliation
Network connectivity interruptedWorkloads may run but remain unreachable

A failed adapter does not necessarily terminate its external workloads. Conversely, a healthy adapter does not guarantee that those workloads are healthy. Recovery requires reconstructing the relationship between Kubernetes Pod identities and backend resources. This is particularly important when replacement Pods are created following node failure. Without reliable cleanup and identity tracking, the old external workload may continue executing alongside its replacement.

Observability and debugging

Start with Kubernetes, then follow the execution path into the provider.

kubectl get nodes -o wide
kubectl describe node <virtual-node>
kubectl get lease -n kube-node-lease <virtual-node> -o yaml
kubectl get pods -A --field-selector spec.nodeName=<virtual-node>
kubectl describe pod -n <namespace> <pod>
kubectl get endpointslices -n <namespace>

Inspect the Virtual Kubelet process logs and correlate the Pod UID with backend resource identifiers. Check provider API errors, provisioning operations, quotas and network reachability.

Commands such as kubectl logs, kubectl exec and kubectl top depend on the relevant provider capabilities and API integration. Their failure does not necessarily indicate that the application itself has stopped. Useful operational signals include provisioning latency, reconciliation errors, stale status, failed deletions and orphaned backend resources. Conventional node CPU utilization alone cannot describe the health of this execution model.

Conclusion

Virtual Kubelet preserves the Kubernetes orchestration interface while replacing the conventional execution path with a provider contract. That contract is the real architectural boundary. Node health, workload status, resource accounting, networking and cleanup must remain meaningful even when the underlying infrastructure is managed by another system.

A virtual node is not simply an infinitely elastic worker. It is a representation of external capacity whose correctness depends on the provider implementation. The Kubernetes API may look familiar. The operational semantics deserve independent verification.

Further reading

Related Articles

Stay ahead

Get the latest insights.

Insights on cloud, AI and open source — delivered to your inbox.

Email subscriptions are coming soon.