Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand the arrangement of Kubernetns Container and VM

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "how to understand Kubernetns container and VM choreography". The content in the article is simple and clear, and it is easy to learn and understand. please follow the editor's train of thought to study and learn "how to understand Kubernetns container and VM choreography".

Before we begin

I used Ubuntu 20.04 and two bare metal servers in the development cluster. Although I explained how to create a similar development cluster in step 1, if you have chosen another Kubernetes or OpenShift environment, you can safely skip it.

Request:

At least one host with 2 CPU,4GB Ram and 20GB storage SPAC

Kubectl command line utility

SSH client

KubeVirt installation and management

Step 1: set up a cluster

Before we start creating the cluster, let's initialize the configuration of the host to fit the Kubernetes. Check out this official tutorial (https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)) and prepare your host.

Let's create a Kubernetes cluster

Sudo kubeadm init-pod-network-cidr=192.168.0.0/16

Execute the following command to configure kubectl:

Mkdir-p $HOME/.kube sudo cp-I / etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id-u): $(id-g) $HOME/.kube/config

Remove the stain on the master so that you can schedule the pod on it.

Kubectl taint nodes-all node-role.kubernetes.io/master-

It should return the following:

Node/ untainted

Step 2: install Calico

Install Calico using the checklist

Kubectl apply-f https://docs.projectcalico.org/manifests/calico.yaml

Step 3: install KubeVirt

With namespace, we can isolate resources into logical modules and manage them more easily.

Kubectl create namespace kubevirt

It is recommended that you use a host that supports hardware virtualization to ensure that your host can use virt-host-validate binaries.

Virt-host-validate qemu QEMU: Checking for hardware virtualization: PASS

If the host lacks this command, you can install it using the distribution package manager, or you can use to check whether the kvm folder is available ls / dev/kvm.

By default, KubeVirt attempts to leverage hardware emulation. However, this feature is not available in all environments, in which case you can enable software emulation in the following ways:

Kubectl create configmap-n kubevirt kubevirt-config\-- from-literal debug.useEmulation=true

Apply these listings and run KubeVirt operator to automatically install all necessary resources.

Kubectl apply-f https://github.com/kubevirt/kubevirt/releases/download/v0.38.1/kubevirt-operator.yaml kubectl apply-f https://github.com/kubevirt/kubevirt/releases/download/v0.38.1/kubevirt-cr.yaml

Enable the migration feature. (this feature depends on storage)

Kubectl create configmap-n kubevirt kubevirt-config-- from-literal feature-gates= "LiveMigration"

Enable the VNC Agent feature component.

Kubectl apply-f kubevirt/vnc.yaml

You can use this command to check the progress of KubeVirt installation.

Kubectl-n kubevirt wait kv kubevirt-- for condition=Available step 4: create a simple VM

First, we create a namespace to isolate the resources for this demonstration.

Kubectl create namespace kv-policy-demo

Now, using virtual machine instances (VMI) to customize resources, we can create a VM that is fully integrated with Kubernetes.

Kubectl create-f-

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report