Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction into Virtual Kubelet

Anubhav Mishra
April 04, 2019

Introduction into Virtual Kubelet

Virtual Kubelet has most recently been accepted into the CNCF as a sandboxed project. In this session, we will give an overview of Virtual Kubelet project. We will highlight the HashiCorp Nomad provider and the Azure provider for Azure Container Instances. Folks can expect to learn about how Virtual Kubelet works and how they can use to for use cases such as bursting capacity, abstraction of infrastructure, and translating any APIs into Kubernetes APIs. Hopefully, this talk helps to spark new ideas, and conversation by bringing up a new way to connect Kubernetes to “any” service or technology.

Anubhav Mishra

April 04, 2019


  1. Virtual Kubelet • Open Sourced by Microsoft in 2017 •

    Extend the Kubernetes API to serverless container platforms like ACI, Fargate, Google Containers. 4
  2. 5

  3. 6

  4. 7

  5. 8

  6. 9

  7. 10

  8. 11

  9. 13

  10. EDITOR // Provider contains the methods required to implement a

    Virtual Kubelet provider type Provider interface { // Takes a Kubernetes Pod and deploys it within the provider CreatePod(ctx context.Context, pod *v1.Pod) error // Takes a Kubernetes Pod and updates it within the provider UpdatePod(ctx context.Context, pod *v1.Pod) error // Takes a Kubernetes Pod and deletes it from the provider DeletePod(ctx context.Context, pod *v1.Pod) error // Retrieves a pod by name from the provider (can be cached) GetPod(ctx context.Context, namespace, name string) (*v1.Pod, error) // Retrieves the logs of a container by name from the provider GetContainerLogs(ctx context.Context, namespace, podName, containerName string, tail int) (string, error) // Executes a command in a container in the pod, copying data between // in/out/err and the container's stdin/stdout/stderr ExecInContainer(name string, uid types.UID, container string, cmd []string, in io.Reader, out, err io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize, timeout time.Duration) error // Retrieves the status of a pod by name from the provider GetPodStatus(ctx context.Context, namespace, name string) (*v1.PodStatus, error) // Retrieves a list of all pods running on the provider (can be cached) GetPods(context.Context) ([]*v1.Pod, error) // Returns a resource list with the capacity constraints of the provider Capacity(context.Context) v1.ResourceList // Returns a list of conditions (Ready, OutOfDisk, etc), which is polled // periodically to update the node status within Kubernetes NodeConditions(context.Context) []v1.NodeCondition // Returns a list of addresses for the node status within Kubernetes NodeAddresses(context.Context) []v1.NodeAddress // Returns NodeDaemonEndpoints for the node status within Kubernetes. NodeDaemonEndpoints(context.Context) *v1.NodeDaemonEndpoints // Returns the operating system the provider is for OperatingSystem() string } 14 Provider Interface Use your imagination
  11. Provider Definition • Provide the back-end plumbing necessary to support

    the lifecycle management of pods, containers and supporting resources in the context of Kubernetes. • Conform to the current API provided by Virtual Kubelet. • Not have access to the Kubernetes API Server and has a well-defined callback mechanism for getting data like secrets or configmaps. 15
  12. 17

  13. Providers • Alibaba Cloud Elastic Container Instance (ECI) • AWS

    Fargate • Azure Batch • Azure Container Instances (ACI) • Kubernetes Container Runtime Interface (CRI) • Huawei Cloud Container Instance (CCI) • HashiCorp Nomad • vSphere Integrated Containers 18