• <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時代的虛擬機管理技術之kubevirt篇
        2021年08月24日

        kubevirt是Red Hat開源的以容器方式運行虛擬機的項目,是基于kubernetes運行,利用k8s CRD為增加資源類型VirtualMachineInstance(VMI),使用CRD的方式是由于kubevirt對虛擬機的管理不局限于pod管理接口。通過CRD機制,kubevirt可以自定義額外的操作,來調整常規容器中不可用的行為。kubevirt可以使用容器的image registry去創建虛擬機并提供VM生命周期管理。

        Kubevirt的架構

        kubevirt以CRD的形式將VM管理接口接入到kubernetes中,通過一個pod去使用libvirtd管理VM的方式,實現pod與VM的一一對應,做到如同容器一般去管理虛擬機,并且做到與容器一樣的資源管理、調度規劃、這一層整體與企業IAAS關系不大,也方便企業的接入,統一納管。

        virt-api:kubevirt是以CRD形式去管理VM Pod,virt-api就是所有虛擬化操作的入口,這里面包括常規的CDR更新驗證、以及console、vm start、stop等操作。

        virt-controller:virt-controller會根據vmi CRD,生成對應的virt-launcher Pod,并且維護CRD的狀態。與kubernetes api-server通訊監控VMI資源的創建刪除等狀態。

        virt-handler:virt-handler會以deamonset形式部署在每一個節點上,負責監控節點上的每個虛擬機實例狀態變化,一旦檢測到狀態的變化,會進行響應并且確保相應的操作能夠達到所需(理想)的狀態。virt-handler還會保持集群級別VMI Spec與相應libvirt域之間的同步;報告libvirt域狀態和集群Spec的變化;調用以節點為中心的插件以滿足VMI Spec定義的網絡和存儲要求。

        virt-launcher:每個virt-launcher pod對應著一個VMI,kubelet只負責virt-launcher pod運行狀態,不會去關心VMI創建情況。virt-handler會根據CRD參數配置去通知virt-launcher去使用本地的libvirtd實例來啟動VMI,隨著Pod的生命周期結束,virt-lanuncher也會去通知VMI去執行終止操作;其次在每個virt-launcher pod中還對應著一個libvirtd,virt-launcher通過libvirtd去管理VM的生命周期,這樣做到去中心化,不再是以前的虛擬機那套做法,一個libvirtd去管理多個VM。

        virtctl:virtctl是kubevirt自帶類似kubectl的命令行工具,它是越過virt-launcher pod這一層去直接管理VM虛擬機,可以控制VM的start、stop、restart。

        Kubevirt如何管理虛擬機?

        虛擬機鏡像制作與管理

        虛擬機鏡像采用容器鏡像形式存放在鏡像倉庫中。創建原理如上圖所示,將Linux發行版本的鏡像文件存放到基礎鏡像的/disk目錄內,鏡像格式支持qcow2、raw、img。通過Dockerfile文件將虛擬機鏡像制作成容器鏡像,然后分別推送到不同的registry鏡像倉庫中??蛻粼趧摻ㄌ摂M機時,根據配置的優先級策略拉取registry中的虛擬機容器鏡像,如果其中一臺registry故障,會另一臺健康的registry拉取鏡像。

        虛擬機生命周期管理

        KubeVirt虛擬機生命周期管理主要分為以下幾種狀態:

        • 虛擬機創建:創建VM對象,并同步創建DataVolume/PVC,從Harbor鏡像倉庫中拉取系統模板鏡像拷貝至目標調度主機,通過調度、IP分配后生成VMI以及管理VM的Launcher Pod從而啟動供業務使用的VM。
        • 虛擬機運行:運行狀態下的VM 可以進行控制臺管理、快照備份/恢復、熱遷移、磁盤熱掛載/熱刪除等操作,此外還可以進行重啟、下電操作,提高VM安全的同時解決業務存儲空間需求和主機異常Hung等問題。
        • 虛擬機關機:關機狀態下的VM可以進行快照備份/恢復、冷遷移、CPU/MEM規格變更、重命名以及磁盤掛載等操作,同時可通過重新啟動進入運行狀態,也可刪除進行資源回收。
        • 虛擬機刪除:對虛機資源進行回收,但VM所屬的磁盤數據仍將保留、具備恢復條件。

        虛擬機創建流程

        虛擬機創建分為創建DataVolume和VMI兩個流程:

        1. 創建DataVolume后,CDI組件創建對應的PVC并且關聯到合適的PV,然后通過臨時Importer Pod拉取虛擬機容器鏡像綁定到DataVolume生成的PV中,并且將鏡像轉換成disk.img文件存儲在PV中供虛擬機使用。

        2. 創建VMI后,等待disk.img轉換成功,然后在對應的Node上啟動Launcher Pod,并將CDI流程生成的PV掛載到Pod內,當做虛擬機啟動的系統盤。Launcher根據VMI的定義生成定義虛擬機的XML文件,然后調用libvirt進程調用Qemu命令創建并且啟動虛擬機。VMI會對Launcher Pod狀態進行同步,反應VM運行的狀態。

        Kubevirt如何實現容器與虛擬機交互TBD

        容器和虛擬機互通

        • 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

        Kubevirt適用場景

        由于Kubervirt提供的成熟的虛擬化能力和性能,并且可以直接通過Kubernetes進行統一管理。所以Kubevirt適合在有PaaS層管理平臺和Kubernetes集群環境的情況下,通過kubevirt中的單一控制平面簡化了對虛擬機的管理,讓用戶無需關心IaaS層,即可輕松在集群內構建、部署出一臺虛擬機進行使用。

        如何搭建Kubevirt

        Kubevirt安裝

        1. 前置條件

        查看硬件是否支持虛擬化

        如果虛擬化不可用,則需要手動開啟軟件仿真

        2. 安裝Kubevirt組件

        直接操作以下命令進行安裝

        3. 檢查實例是否正常運行

        4. 啟動相關特性

        修改kubevirt-config configmap內的數據

        5. 安裝virtctl

        安裝kubevirt命令行工具

        6. 安裝CDI

        CDI(containerized-data-importer) 是kubernetes的持久存儲管理插件,幫助kubevirt構建磁盤鏡像,可以將不同來源的數據源(url、container image、upload....)來填充pvc的能力。

        獲取最新版,進行安裝

        安裝完畢后,會在cdi namespace下,啟動cdi相關組件

        至此,kubevirt安裝完畢

        創建虛擬機

        1. 準備一個虛擬機鏡像

        通過dockerfile構建出一個虛擬機鏡像

        2. 創建一臺VM

        編輯好yaml文件,通過kubectl命令拉起一臺vm

        添加評論
        諧云
        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片短视频在线观看国产