Git Product home page Git Product logo

alibabacloud-eci's Introduction

Virtual Kubelet

Go Reference

Virtual Kubelet is an open source Kubernetes kubelet implementation that masquerades as a kubelet for the purposes of connecting Kubernetes to other APIs. This allows the nodes to be backed by other services like ACI, AWS Fargate, IoT Edge, Tensile Kube etc. The primary scenario for VK is enabling the extension of the Kubernetes API into serverless container platforms like ACI and Fargate, though we are open to others. However, it should be noted that VK is explicitly not intended to be an alternative to Kubernetes federation.

Virtual Kubelet features a pluggable architecture and direct use of Kubernetes primitives, making it much easier to build on.

We invite the Kubernetes ecosystem to join us in empowering developers to build upon our base. Join our slack channel named, virtual-kubelet, within the Kubernetes slack group.

The best description is "Kubernetes API on top, programmable back."

Table of Contents

How It Works

The diagram below illustrates how Virtual-Kubelet works.

diagram

Usage

Virtual Kubelet is focused on providing a library that you can consume in your project to build a custom Kubernetes node agent.

See godoc for up to date instructions on consuming this project: https://godoc.org/github.com/virtual-kubelet/virtual-kubelet

There are implementations available for several providers, see those repos for details on how to deploy.

Current Features

  • create, delete and update pods
  • container logs, exec, and metrics
  • get pod, pods and pod status
  • capacity
  • node addresses, node capacity, node daemon endpoints
  • operating system
  • bring your own virtual network

Providers

This project features a pluggable provider interface developers can implement that defines the actions of a typical kubelet.

This enables on-demand and nearly instantaneous container compute, orchestrated by Kubernetes, without having VM infrastructure to manage and while still leveraging the portable Kubernetes API.

Each provider may have its own configuration file, and required environmental variables.

Providers must provide the following functionality to be considered a supported integration with Virtual Kubelet.

  1. Provides the back-end plumbing necessary to support the lifecycle management of pods, containers and supporting resources in the context of Kubernetes.
  2. Conforms to the current API provided by Virtual Kubelet.
  3. Does not have access to the Kubernetes API Server and has a well-defined callback mechanism for getting data like secrets or configmaps.

Admiralty Multi-Cluster Scheduler

Admiralty Multi-Cluster Scheduler mutates annotated pods into "proxy pods" scheduled on a virtual-kubelet node and creates corresponding "delegate pods" in remote clusters (actually running the containers). A feedback loop updates the statuses and annotations of the proxy pods to reflect the statuses and annotations of the delegate pods. You can find more details in the Admiralty Multi-Cluster Scheduler documentation.

Alibaba Cloud ECI Provider

Alibaba Cloud ECI(Elastic Container Instance) is a service that allow you run containers without having to manage servers or clusters.

You can find more details in the Alibaba Cloud ECI provider documentation.

Configuration File

The alibaba ECI provider will read configuration file specified by the --provider-config flag.

The example configure file is in the ECI provider repository.

Azure Container Instances Provider

The Azure Container Instances Provider allows you to utilize both typical pods on VMs and Azure Container instances simultaneously in the same Kubernetes cluster.

You can find detailed instructions on how to set it up and how to test it in the Azure Container Instances Provider documentation.

Configuration File

The Azure connector can use a configuration file specified by the --provider-config flag. The config file is in TOML format, and an example lives in providers/azure/example.toml.

AWS Fargate Provider

AWS Fargate is a technology that allows you to run containers without having to manage servers or clusters.

The AWS Fargate provider allows you to deploy pods to AWS Fargate. Your pods on AWS Fargate have access to VPC networking with dedicated ENIs in your subnets, public IP addresses to connect to the internet, private IP addresses to connect to your Kubernetes cluster, security groups, IAM roles, CloudWatch Logs and many other AWS services. Pods on Fargate can co-exist with pods on regular worker nodes in the same Kubernetes cluster.

Easy instructions and a sample configuration file is available in the AWS Fargate provider documentation. Please note that this provider is not currently supported.

Elotl Kip

Kip is a provider that runs pods in cloud instances, allowing a Kubernetes cluster to transparently scale workloads into a cloud. When a pod is scheduled onto the virtual node, Kip starts a right-sized cloud instance for the pod's workload and dispatches the pod onto the instance. When the pod is finished running, the cloud instance is terminated.

When workloads run on Kip, your cluster size naturally scales with the cluster workload, pods are strongly isolated from each other and the user is freed from managing worker nodes and strategically packing pods onto nodes.

HashiCorp Nomad Provider

HashiCorp Nomad provider for Virtual Kubelet connects your Kubernetes cluster with Nomad cluster by exposing the Nomad cluster as a node in Kubernetes. By using the provider, pods that are scheduled on the virtual Nomad node registered on Kubernetes will run as jobs on Nomad clients as they would on a Kubernetes node.

For detailed instructions, follow the guide here.

Interlink Provider

interLink provides an abstraction for the execution of a Kubernetes pod on any remote resource that has the capability to manage a container's execution lifecycle. The use cases that drove the initial development of the tool are the Slurm-powered HPC centers, regardless the plugin based design is enabling several additional use cases to provide Kubernetes-API based access to infrastracture that cannot host a Kubelet processes. InterLink is a Virtual Kubelet provider that can manage container lifecycle through a well defined API specification, allowing for any resource provider to be integrated with a simple http server and a handful of methods. In other words, this is an attempt to streamline the process of creating custom Virtual Kubelet providers, avoiding the need for any resource provider to implement its own version of a Kubelet workflow, which would require having some domain expertise in the Kubernetes internals.

For detailed instruction, follow the guide here.

Liqo Provider

Liqo implements a provider for Virtual Kubelet designed to transparently offload pods and services to "peered" Kubernetes remote cluster. Liqo is capable of discovering neighbor clusters (using DNS, mDNS) and "peer" with them, or in other words, establish a relationship to share part of the cluster resources. When a cluster has established a peering, a new instance of the Liqo Virtual Kubelet is spawned to seamlessly extend the capacity of the cluster, by providing an abstraction of the resources of the remote cluster. The provider combined with the Liqo network fabric extends the cluster networking by enabling Pod-to-Pod traffic and multi-cluster east-west services, supporting endpoints on both clusters.

For detailed instruction, follow the guide here

OpenStack Zun Provider

OpenStack Zun provider for Virtual Kubelet connects your Kubernetes cluster with OpenStack in order to run Kubernetes pods on OpenStack Cloud. Your pods on OpenStack have access to OpenStack tenant networks because they have Neutron ports in your subnets. Each pod will have private IP addresses to connect to other OpenStack resources (i.e. VMs) within your tenant, optionally have floating IP addresses to connect to the internet, and bind-mount Cinder volumes into a path inside a pod's container.

./bin/virtual-kubelet --provider="openstack"

For detailed instructions, follow the guide here.

Tensile Kube Provider

Tensile kube is contributed by tencent games, which is provider for Virtual Kubelet connects your Kubernetes cluster with other Kubernetes clusters. This provider enables us extending Kubernetes to an unlimited one. By using the provider, pods that are scheduled on the virtual node registered on Kubernetes will run as jobs on other Kubernetes clusters' nodes.

Adding a New Provider via the Provider Interface

Providers consume this project as a library which implements the core logic of a Kubernetes node agent (Kubelet), and wire up their implementation for performing the neccessary actions.

There are 3 main interfaces:

PodLifecycleHandler

When pods are created, updated, or deleted from Kubernetes, these methods are called to handle those actions.

godoc#PodLifecylceHandler

type PodLifecycleHandler interface {
    // CreatePod takes a Kubernetes Pod and deploys it within the provider.
    CreatePod(ctx context.Context, pod *corev1.Pod) error

    // UpdatePod takes a Kubernetes Pod and updates it within the provider.
    UpdatePod(ctx context.Context, pod *corev1.Pod) error

    // DeletePod takes a Kubernetes Pod and deletes it from the provider.
    DeletePod(ctx context.Context, pod *corev1.Pod) error

    // GetPod retrieves a pod by name from the provider (can be cached).
    GetPod(ctx context.Context, namespace, name string) (*corev1.Pod, error)

    // GetPodStatus retrieves the status of a pod by name from the provider.
    GetPodStatus(ctx context.Context, namespace, name string) (*corev1.PodStatus, error)

    // GetPods retrieves a list of all pods running on the provider (can be cached).
    GetPods(context.Context) ([]*corev1.Pod, error)
}

There is also an optional interface PodNotifier which enables the provider to asynchronously notify the virtual-kubelet about pod status changes. If this interface is not implemented, virtual-kubelet will periodically check the status of all pods.

It is highly recommended to implement PodNotifier, especially if you plan to run a large number of pods.

godoc#PodNotifier

type PodNotifier interface {
    // NotifyPods instructs the notifier to call the passed in function when
    // the pod status changes.
    //
    // NotifyPods should not block callers.
    NotifyPods(context.Context, func(*corev1.Pod))
}

PodLifecycleHandler is consumed by the PodController which is the core logic for managing pods assigned to the node.

	pc, _ := node.NewPodController(podControllerConfig) // <-- instatiates the pod controller
	pc.Run(ctx) // <-- starts watching for pods to be scheduled on the node

NodeProvider

NodeProvider is responsible for notifying the virtual-kubelet about node status updates. Virtual-Kubelet will periodically check the status of the node and update Kubernetes accordingly.

godoc#NodeProvider

type NodeProvider interface {
    // Ping checks if the node is still active.
    // This is intended to be lightweight as it will be called periodically as a
    // heartbeat to keep the node marked as ready in Kubernetes.
    Ping(context.Context) error

    // NotifyNodeStatus is used to asynchronously monitor the node.
    // The passed in callback should be called any time there is a change to the
    // node's status.
    // This will generally trigger a call to the Kubernetes API server to update
    // the status.
    //
    // NotifyNodeStatus should not block callers.
    NotifyNodeStatus(ctx context.Context, cb func(*corev1.Node))
}

Virtual Kubelet provides a NaiveNodeProvider that you can use if you do not plan to have custom node behavior.

godoc#NaiveNodeProvider

NodeProvider gets consumed by the NodeController, which is core logic for managing the node object in Kubernetes.

	nc, _ := node.NewNodeController(nodeProvider, nodeSpec) // <-- instantiate a node controller from a node provider and a kubernetes node spec
	nc.Run(ctx) // <-- creates the node in kubernetes and starts up he controller

API endpoints

One of the roles of a Kubelet is to accept requests from the API server for things like kubectl logs and kubectl exec. Helpers for setting this up are provided here

Scrape Pod metrics

If you want to use HPA(Horizontal Pod Autoscaler) in your cluster, the provider should implement the GetStatsSummary function. Then metrics-server will be able to get the metrics of the pods on virtual-kubelet. Otherwise, you may see No metrics for pod on metrics-server, which means the metrics of the pods on virtual-kubelet are not collected.

Testing

Unit tests

Running the unit tests locally is as simple as make test.

End-to-end tests

Check out test/e2e for more details.

Known quirks and workarounds

Missing Load Balancer IP addresses for services

Providers that do not support service discovery

Kubernetes 1.9 introduces a new flag, ServiceNodeExclusion, for the control plane's Controller Manager. Enabling this flag in the Controller Manager's manifest allows Kubernetes to exclude Virtual Kubelet nodes from being added to Load Balancer pools, allowing you to create public facing services with external IPs without issue.

Workaround

Cluster requirements: Kubernetes 1.9 or above

Enable the ServiceNodeExclusion flag, by modifying the Controller Manager manifest and adding --feature-gates=ServiceNodeExclusion=true to the command line arguments.

Contributing

Virtual Kubelet follows the CNCF Code of Conduct. Sign the CNCF CLA to be able to make Pull Requests to this repo.

Monthly Virtual Kubelet Office Hours are held at 10am PST on the second Thursday of every month in this zoom meeting room. Check out the calendar here.

Our google drive with design specifications and meeting notes are here.

We also have a community slack channel named virtual-kubelet in the Kubernetes slack. You can also connect with the Virtual Kubelet community via the mailing list.

alibabacloud-eci's People

Contributors

arapulido avatar bketelsen avatar cpuguy83 avatar denverdino avatar erikstmartin avatar fisherxu avatar jlegrone avatar krisnova avatar mqliang avatar muya-zj avatar pires avatar rbitia avatar ritazh avatar robbiezhang avatar sargun avatar yashdesai93 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

alibabacloud-eci's Issues

关于版本更新

目前看到github已经没有同步了。请问这个repo不维护了? 只能用ACK中的组件了么?

Failed to create the example pod following documentation

Hi, I got this

time="2021-04-22T13:27:49Z" level=info msg="Event(v1.ObjectReference{Kind:\"Pod\", Namespace:\"default\", Name:\"nginx\", UID:\"af2d81f4-8ffd-4f60-ae46-57fb3c54ff9e\", APIVersion:\"v1\", ResourceVersion:\"891837\", FieldPath:\"\"}): type: 'Warning' reason: 'FailedScheduling' SDK.ServerError\nErrorCode: UnknownError\nRecommend: https://error-center.aliyun.com/status/search?Keyword=UnknownError&source=PopGw\nRequestId: BC28AEAB-E2D6-493F-9CE6-DCD78DBCD9BB\nMessage: An unknown error occurred while processing your request" provider=alibabacloud

and

Events:
  Type     Reason            Age   From                            Message
  ----     ------            ----  ----                            -------
  Normal   Scheduled         4m6s  default-scheduler               Successfully assigned default/nginx to virtual-kubelet
  Warning  FailedScheduling  4m2s  virtual-kubelet/pod-controller  SDK.ServerError
ErrorCode: UnknownError
Recommend: https://error-center.aliyun.com/status/search?Keyword=UnknownError&source=PopGw
RequestId: A01E52AA-DC0E-41CB-8E80-32C514C3413F
Message: An unknown error occurred while processing your request
  Warning  FailedScheduling  3m59s  virtual-kubelet/pod-controller  SDK.ServerError
ErrorCode: UnknownError
Recommend: https://error-center.aliyun.com/status/search?Keyword=UnknownError&source=PopGw
RequestId: 5484C7D6-2533-45DD-BE7A-5C82ABC0E84D
Message: An unknown error occurred while processing your request
  Warning  FailedScheduling  3m57s  virtual-kubelet/pod-controller  SDK.ServerError
ErrorCode: UnknownError
Recommend: https://error-center.aliyun.com/status/search?Keyword=UnknownError&source=PopGw
RequestId: DEEE54DB-33C3-4B07-BBBA-57A846E67BEA
Message: An unknown error occurred while processing your request
  Warning  FailedScheduling  3m55s  virtual-kubelet/pod-controller  SDK.ServerError
ErrorCode: UnknownError
Recommend: https://error-center.aliyun.com/status/search?Keyword=UnknownError&source=PopGw
RequestId: 11936348-BFD4-4BB3-8923-08292488D7B5
Message: An unknown error occurred while processing your request
  Warning  FailedScheduling  3m51s  virtual-kubelet/pod-controller  SDK.ServerError
ErrorCode: UnknownError
Recommend: https://error-center.aliyun.com/status/search?Keyword=UnknownError&source=PopGw
RequestId: 7C530554-CD07-42E3-888F-9FE91CF726AE
Message: An unknown error occurred while processing your request
  Warning  FailedScheduling  3m46s  virtual-kubelet/pod-controller  SDK.ServerError
ErrorCode: UnknownError
Recommend: https://error-center.aliyun.com/status/search?Keyword=UnknownError&source=PopGw
RequestId: 1CAA6A3A-7B36-4116-A684-56BFB24B990B
Message: An unknown error occurred while processing your request
  Warning  FailedScheduling  3m38s  virtual-kubelet/pod-controller  SDK.ServerError
ErrorCode: UnknownError
Recommend: https://error-center.aliyun.com/status/search?Keyword=UnknownError&source=PopGw
RequestId: 543623BD-2CC8-4605-A3E5-BAEEFE2A7877
Message: An unknown error occurred while processing your request
  Warning  FailedScheduling  3m23s  virtual-kubelet/pod-controller  SDK.ServerError
ErrorCode: UnknownError
Recommend: https://error-center.aliyun.com/status/search?Keyword=UnknownError&source=PopGw
RequestId: 0E4C1343-2DEA-4565-80CD-0D325C488838
Message: An unknown error occurred while processing your request
  Warning  FailedScheduling  2m54s  virtual-kubelet/pod-controller  SDK.ServerError
ErrorCode: UnknownError
Recommend: https://error-center.aliyun.com/status/search?Keyword=UnknownError&source=PopGw
RequestId: E0C8402B-C01B-4438-A7D3-AA807D9E738A
Message: An unknown error occurred while processing your request
  Warning  FailedScheduling  59s (x2 over 2m1s)  virtual-kubelet/pod-controller  (combined from similar events): SDK.ServerError
ErrorCode: UnknownError
Recommend: https://error-center.aliyun.com/status/search?Keyword=UnknownError&source=PopGw
RequestId: 5693AA32-C8A5-4D23-8F67-E1039A89E6A2
Message: An unknown error occurred while processing your request

while trying the steps in

https://help.aliyun.com/document_detail/198982.html?spm=a2c4g.11186623.6.564.523b6a3fltaPRi#section-33b-aoa-45i

as well as

https://github.com/virtual-kubelet/alibabacloud-eci/blob/master/README.md

It's hard to tell what went wrong.

calculate gpu count error strconv.Atoi: parsing "": invalid syntax

apiVersion: v1
kind: Pod
metadata:
  name: tensorflow
  annotations:
    k8s.aliyun.com/eci-gpu-type : "T4"
spec:
  containers:
  - image: registry-vpc.cn-hangzhou.aliyuncs.com/ack-serverless/tensorflow
    name: tensorflow
    command:
    - "sh"
    - "-c"
    - "python models/tutorials/image/imagenet/classify_image.py"
    resources:
      limits:
        nvidia.com/gpu: "1"
  - image: some-other-container 
    name: no-gpu-limits

if apply this pod into the cluster, will cause

  Warning  ParamsAdapterFailed  26s   virtual-kubelet-0/pod-controller  calculate gpu count error strconv.Atoi: parsing "": invalid syntax

make build failed

$ make build
CGO_ENABLED=0 go build -ldflags '-extldflags "-static"' -o bin/virtual-kubelet -ldflags='-X "main.buildVersion=3858dfe" -X "main.buildTime=2020-01-04-11:41 UTC"' ./cmd/virtual-kubelet
go: k8s.io/[email protected] requires
	k8s.io/[email protected]: invalid pseudo-version: does not match version-control timestamp (2019-06-13T15:04:21Z)
make: *** [bin/virtual-kubelet] Error 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.