• <button id="4os99"><acronym id="4os99"><menuitem id="4os99"></menuitem></acronym></button>
  • <th id="4os99"><pre id="4os99"></pre></th>
  • <em id="4os99"><tr id="4os99"><kbd id="4os99"></kbd></tr></em>
  • <form id="4os99"></form>
      1. <progress id="4os99"></progress>
        登錄
        立即咨詢

        語言選擇

        諧云 諧云
        在這里探索云原生
        后Kubernetes時代的虛擬機管理技術之Virtual-Kubelet篇
        2021年08月17日

        在了解virtual-Kubelet之前,我們先了解下什么是Kubelet。

        Kubelet 是在每個Node節點上運行的主要 “節點代理”。在Kubernetes集群中每個節點都會啟動一個kubelet進程,kubelet基于PodSpec來工作。每個Pod Spec是一個描述Pod的YAML或JSON對象。Kubelet接受通過各種機制(主要是通過Apiserver)提供的一組Pod Spec,并確保這些Pod Spec中描述的容器處于運行狀態且運行狀況良好。同時Kubelet還通過cAdvisor監控容器和節點資源,定期向上報當前節點的健康狀態以及資源使用情況,可以把Kubelet理解成[Server-Agent]架構中的Agent。

        Virtual-Kubelet是基于Kubelet的典型特性實現,向上偽裝成Kubelet,從而模擬出Node對象,對接Kubernetes的原生資源對象;向下提供API,可對接其他資源管理平臺提供的Provider。不同的平臺通過實現Virtual-Kubelet定義的方法,允許節點由其對應的Provider提供(如ACI,AWS Fargate,IoT Edge,Tensile Kube等)支持,實現Serverless,或者將其擴展到如Docker Swarm、Openstack Zun等容器平臺中,也可以通過Provider納管其他Kubernetes集群,甚至是原生的IaaS層平臺(VMware、zstack、openstack)。

        最好的描述是Kubernetes API on top,programmable back。

        Virtual-Kubelet如何管理虛擬機是本文討論重點。

        Virutal-Kubelet的架構

        Virtual-Kubelet 模擬了Node資源對象,并負責對Pod調度到Virtual-Kubelet偽裝的虛擬節點之后,對Pod進行生命周期管理。

        當前支持原生Kubernetes特性:

        • 創建,刪除和更新Pod
        • Container的日志,管理和監控
        • 獲取單個Pod或多個Pod狀態
        • 節點地址,節點容量,節點守護程序端點
        • 管理操作系統
        • 攜帶私有虛擬網絡

        Virtual-Kubelet如何管理虛擬機?

        虛擬機生命周期管理

        Virtual-Kubelet在虛擬機調度和操作方面可以復用Kubernetes原生的資源對象,但Pod在Kubelet管理下的生命周期僅存在創建、運行和銷毀,實際對于虛擬機的開關機、備份和遷移等操作無法實現映射關系,因此對于復雜的生命周期管理,需要通過自定義CRD方式支持不同類型的IaaS平臺,每一個VM-CR對應一個IaaS層VM實例。

        對于VM-CR操作主要可以分為兩類:

        • 對VM運行狀態變更
        • 創建和銷毀:可以對應一個VM-CR的create/delete
        • VM啟停操作對應VM-CR replicas數量的變更:開機0→1關機1→0
        • VM規格變更:修改VM-CR Spec資源定義
        • kubectl logs/exec VM-pod:實現對Pod的訪問
        • 對VM進行備份/遷移
        • VM備份采用創建對應Backup-Job對象,通過與VM-CR實例pod親和方式,將Backup-Job調度置VM實際節點所運行的Virtual-Kubelet節點上,備份狀態與Job執行狀態一致
        • VM遷移采用Kubernetes原生的節點調度方式,IaaS平臺每一個負載VM的物理機對應一個Kubernetes集群內的Virtual-Kubelet,VM-CR實例Pod的調度由Kubernetes控制面管理

        虛擬機存儲管理

        由于Virtual-Kubelet中Pod僅作為邏輯概念,IaaS層存儲無法與Kubernetes集群公用,但可抽象為Kubernetes原生定義的PV/PVC,PV的access mode能力依賴IaaS層能力,并需要實現對應平臺和底層存儲的Provider和Provisioner。

        Virtual-Kubelet如何實現容器與虛擬機交互

        容器和虛擬機互通

        • Virtual-Kubelet對應的Node會上報節點上Pod的Endpoint,假定Kubernetes集群和IaaS層平臺部署在同一個二層網絡下,則集群內容器Pod可以訪問VM-Pod,但容器Pod對于VM-Pod不可見;
        • 針對上一點可以通過Macvlan等網絡插件,將容器-Pod,降維至二層網絡上,實現容器-Pod和虛擬機互通,有一定硬件要求。

        如何實現一套集群下虛擬機與容器的混合調度與資源隔離

        • Virtual-Kubelet提供的是一個虛擬節點用來向Kubernetes上報Node對象和Pod的狀態和資源情況,虛擬機資源和集群內節點資源完全隔離;
        • 在引入Virtual-Kubelet的情況下,需要對Virtual-Kubelet節點配置Taint和Tolerations,保證容器-Pod和VM-Pod調度分離。

        服務發現

        Virtual-Kubelet,通過Provider實現的API將IaaS層VM信息抽象成對應Pod對象的信息的方式來上報Endpoints,可以通過給CR添加no selector Service,待VM-Pod拉起后補充address至對應的Service。

        Virutal-Kubelet適用場景

        適用場景

        Virtual-Kuberlet適合在已有IaaS層管理平臺和Kubernetes集群環境下進行二者的打通,實現在Kubernetes集群上統一管理容器和非容器平臺,同時由于Virtual-Kubelet在Serverless和納管其他已有容器平臺(Openstack Zun,Docker Swarm)方面也具有很高適配性,Virtual-Kubelet可以提供一套統一的API,方便開發者打通全流程。

        Virtual-Kubelet的優缺點

        優點

        • 一個開源的Kubelet實現,使用Kubernetes源語,使構建、部署更簡單
        • 提供Kubelet典型特性接口,Provider僅需實現對應服務管理平臺資源到Node和Pod對象特性的實現,不需要考慮如何訪問Kubernetes
        • 靈活性高,Severless實踐、對接現有容器平臺、對接現有IaaS平臺均有一定前景
        • Virtual-Kubelet設計將virtual-kubelet和Provider高度分離,Virtual-Kubelet使對于異構服務平臺具有很高的兼容性(不同架構如:ARM、S390x,不同CRI如:Kata、PodMan),不光是可以納關IaaS平臺對于其他Kubernetes集群也可以實現管理

        缺點

        • 將非集群內資源抽象成Node和Pod對象對資源使用上有一定局限性,很難提供超出原有kubelet和IaaS平臺能力范疇,IaaS深度整合需要自行實現CRD
        • 僅能作為轉換器,用于容器和虛擬機統一管理時還是需要依托已有的平臺能力,無法像Kubevirt等方案作為一個單獨的Iaas管理平臺使用

        Virtual-Kubelet開發及部署

        開發自定義的Provider

        Virtual-Kubelet項目本身并不提供Provider,而是提供一系列定義Kubelet典型操作的接口,開發者需要根據應用場景實現對應的Provider。使Kubernetes可以進行按需和幾乎即時的Container的計算、調度,而無需管理VM基礎結構,同時仍可利用可移植的KubernetesAPI。

        實現遵循以下三個準則:

        • 提供必要的后端管道(back-end plumbing),以在Kubernetes的Context中支持Pods,Containers和相關資源的的生命周期管理
        • 符合Virtual-Kubelet當前提供的API
        • 沒有訪問Kubernetes APIServer的權限,通過實現具有定義良好的回調機制來獲取Secrets或Configmap之類的數據

        創建一個新的Provider主要需要通過調用Virtual-Kubelet提供的庫實現如下三個接口:

        • PodLifecylceHandler:用于Pod生命周期的管理
        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)
        }
        • PodNotifier:該接口允許Provider提供異步通知Virtual-Kubelet有關Pod狀態更新的信息,如未實現該接口的話,Virtual-Kubelet會定期檢查所有Pod的狀態,在計劃運行大量Pod的場景中強烈推薦實現該接口
        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))
        }
        • NodeProvider:NodeProvider負責通知虛擬小程序有關節點狀態更新的信息。Virtual-Kubelet將定期檢查節點的狀態并相應地更新Kubernetes,如果不打算額外定義Node特性,可以直接使用Virtual-Kubelet提供的NativeNodeProvider
        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))
        }
        • API Endpoints:用于實現kubectl logs和kubectl exec

        部署

        Provider部署簡單僅需要在要添加目標集群的主機中添加二進制程序并根據IaaS層配置啟動即可:

        ./bin/virtual-kubelet --provider="hc-vmware-provider" --exsi="X.X.X.X"
        添加評論
        諧云
        2024年03月02日
        添加回復
        回復:Hi, i think that i saw you visited my site thus i came to “return the favor”.I'm trying to find things to enhance my site!I suppose its ok to use some of your ideas!!
        添加回復
        回復:This information is invaluable. Where can I find out more?
        添加回復
        回復:Wonderful blog! Do you have any suggestions for aspiring writers? I'm hoping to start my own website soon but I'm a little lost on everything. Would you suggest starting with a free platform like Wordpress or go for a paid option? There are so many choices out there that I'm completely confused .. Any ideas? Many thanks!
        添加回復
        回復:Thanks on your marvelous posting! I quite enjoyed reading it, you are a great author. I will always bookmark your blog and will come back very soon. I want to encourage you to definitely continue your great posts, have a nice weekend!
        添加回復
        回復:I'm impressed, I have to admit. Rarely do I encounter a blog that's both educative and entertaining, and let me tell you, you have hit the nail on the head. The issue is an issue that too few folks are speaking intelligently about. Now i'm very happy that I came across this in my hunt for something relating to this.
        添加回復
        回復:Having read this I believed it was very enlightening. I appreciate you taking the time and energy to put this article together. I once again find myself spending a significant amount of time both reading and posting comments. But so what, it was still worthwhile!
        添加回復
        回復:Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You definitely know what youre talking about, why throw away your intelligence on just posting videos to your blog when you could be giving us something informative to read?
        添加回復
        回復:Every weekend i used to pay a quick visit this site, because i want enjoyment, for the reason that this this web page conations really good funny information too.
        添加回復
        回復:Terrific article! This is the kind of info that are meant to be shared across the web. Shame on Google for now not positioning this publish higher! Come on over and talk over with my website . Thanks =)
        添加回復
        回復:This website was... how do I say it? Relevant!! Finally I have found something which helped me. Kudos!
        添加回復
        回復:Its not my first time to visit this website, i am visiting this site dailly and take nice data from here everyday.
        添加回復
        回復:Hi there every one, here every person is sharing such know-how, so it's good to read this website, and I used to pay a visit this website everyday.
        添加回復
        回復:fantastic points altogether, you simply received a brand new reader. What may you recommend about your put up that you simply made some days ago? Any positive?
        添加回復
        回復:I am really loving the theme/design of your site. Do you ever run into any internet browser compatibility issues? A handful of my blog readers have complained about my website not working correctly in Explorer but looks great in Opera. Do you have any suggestions to help fix this problem?
        添加回復
        回復:If you wish for to get a great deal from this post then you have to apply these methods to your won website.
        添加回復
        回復:Hi there! This is my 1st comment here so I just wanted to give a quick shout out and tell you I genuinely enjoy reading your articles. Can you suggest any other blogs/websites/forums that go over the same topics? Thanks a ton!
        添加回復
        回復:Your style is really unique in comparison to other people I have read stuff from. Many thanks for posting when you've got the opportunity, Guess I'll just bookmark this site.
        添加回復
        回復:I read this piece of writing fully regarding the difference of most up-to-date and preceding technologies, it's amazing article.
        添加回復
        回復:Hey I know this is off topic but I was wondering if you knew of any widgets I could add to my blog that automatically tweet my newest twitter updates. I've been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something like this. Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new updates.
        添加回復
        回復:Good day I am so thrilled I found your blog, I really found you by mistake, while I was searching on Bing for something else, Anyways I am here now and would just like to say thanks a lot for a fantastic post and a all round interesting blog (I also love the theme/design), I don’t have time to go through it all at the minute but I have bookmarked it and also added in your RSS feeds, so when I have time I will be back to read more, Please do keep up the awesome work.
        添加回復
        回復:You could certainly see your skills in the work you write. The world hopes for more passionate writers like you who aren't afraid to say how they believe. All the time follow your heart.
        添加回復
        回復:Hi there! Someone in my Myspace group shared this website with us so I came to take a look. I'm definitely loving the information. I'm bookmarking and will be tweeting this to my followers! Exceptional blog and great design.
        添加回復
        回復:My brother suggested I might like this blog. He was totally right. This post truly made my day. You can not imagine just how much time I had spent for this information! Thanks!
        添加回復
        諧云
        2024年03月02日
        添加回復
        諧云 CpjJwWHV
        2024年03月02日
        555
        添加回復
        gBqsPxAZ回復CpjJwWHV:555
        添加回復
        gBqsPxAZ回復CpjJwWHV:555
        添加回復
        gBqsPxAZ回復CpjJwWHV:555
        添加回復
        gBqsPxAZ回復CpjJwWHV:555
        添加回復
        回復CpjJwWHV:
        添加回復
        回復CpjJwWHV:
        添加回復
        諧云 CpjJwWHV
        2024年03月02日
        555
        添加回復
        gBqsPxAZ回復CpjJwWHV:555
        添加回復
        gBqsPxAZ回復CpjJwWHV:555
        添加回復
        gBqsPxAZ回復CpjJwWHV:555
        添加回復
        gBqsPxAZ回復CpjJwWHV:555
        添加回復
        回復CpjJwWHV:
        添加回復
        回復CpjJwWHV:
        添加回復
        回復CpjJwWHV:
        添加回復
        回復CpjJwWHV:
        添加回復
        回復CpjJwWHV:
        添加回復
        申請合作咨詢
        您可以通過此表單填寫您的合作意向,我們將會盡快與您取得聯系!
        或撥打電話0571-87607309
        *姓名:
        *手機:
        *郵箱:
        備注:
        備注:
        登錄
        登錄
        注冊賬號 忘記密碼
        注冊
        {{ code.btn }}
        注冊
        立即登錄 忘記密碼?
        忘記密碼
        {{ code.btn }}
        確定
        立即登錄 忘記密碼?
        立即咨詢
        欧美一级a人与免费2019|99久热精品免费观看动漫官网|久久久久国色av免费看|免费A片短视频在线观看国产