OpenShift Virtualization - Run VMs on OpenShift with KubeVirt - Windows Server

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
are you modernizing your it infrastructure moving things to containers and microservices and using openshift to manage and run them have you had to avoid moving some workloads to openshift just because some or all of it needs to run in a vm well if that's the case openshift virtualization might be just what you're after with openshift virtualization you can run your bms inside of pods and manage them just like you would any other pod it's a great way to help you transition to container based and micro services based workloads let's now take a look at how we can enable this and deploy a windows vm to the openshift platform before we get into the implementation of openshift virtualization let's take a real quick look at why you'd want to run vms on your openshift cluster in my opinion these are the primary reasons but of course you might think of some more by the end of this video once you see it in action i think the first and most obvious reason is that you may not be able to run your applications inside of a container and that could be for any number of reasons for example you're running an unsupported kernel potentially you could be running a proprietary os that isn't supported in containers or maybe even you just have an app that runs a specific way and you don't actually have any source code associated with that app so you just need to make do with what you have another reason is to maintain a single point of management so with openshift virtualization you can host and manage all your virtualized workloads on the same platform as your container-based workloads so you don't need to maintain two different platforms there it's also a very convenient way to use your existing systems that you may already have configured and deployed like monitoring storage ci cd pipelines logging alerting backups networking and all those sorts of things you can use them with both your containers and your vms on the one platform scalability is something you get pretty much for free with kubernetes and running vms on openshift is no different and finally it also helps you adopt a cloud native architecture so you can move towards containerization gradually for example you could potentially start with a monolithic application running in a vm on openshift and then slowly break away components from that into smaller microservices where you can still leverage some components running in the vm until everything has been containerized so what does running avm on openshift actually look like well from a very high level it's just the regular vm processors that you would already be familiar with running inside of a regular pod so like you can see here the vm can potentially be running alongside other containers in that same pod too so ultimately the vm is still a pod that pod by default is placed on the pod network meaning that the vm inside of that pod can access the pod network inside of openshift and it also means that you can continue to manage your vms similarly to how you would manage any other pod now i'll go into more detail on the openshift virtualization component soon but if you want more detail on what makes up a container and really the same details applied to pods as well you can watch my video on running containers where i cover things like name spaces and c groups i'll make sure i include a link to that in the description okay so two last things before we move on with the install firstly the technology behind openshift virtualization is the open source project called cuber so you'll see that name cubevert used all over the place and that's why and secondly there are specific os's that are supported by openshift virtualization so at the time of this recording they are rel 678 windows server 2012 r2 2016 and 2019 and also windows 10. alright so there are some prerequisites for this firstly you'll need a running openshift 45 or newer cluster and ideally one running on bare metal and that's because nested virtualization isn't supported by red hat and it's generally just less performant anyway i'll include the link to a video i made on installing openshift 4 on bare metal in the description if you don't already have a cluster and you want to set one up now in saying all that the cluster i have running is actually a virtualized cluster running on esxi because i don't have the infrastructure for a physical installation so i'll be setting this up with nested virtualization enabled just because it's a home lab so it'll work with nested virtualization but just be mindful that it's not supported so if you're like me and doing this in a virtualized environment you'll probably need to enable support for nested virtualization so i'll quickly show you how to do that with esxi so you can see here that i'm on worker node 1 of my cluster and if i grip and have a look at the cpu info you can see that i currently don't have vmx or virtual machine extensions enabled on this host so that is a requirement we need to enable that and for me that means that i need to head over to the esxi dashboard and do that so i can shut down worker one once that's shut down i can edit the machine and we want to enable virtualization by selecting cpu here and we can tick the box for hardware virtualization now while you're doing this it would also be a good time to think about sizing your nodes appropriately for vms that's for any vms that you plan on running on any specific nodes so i'm going to install windows server essentials 2019 so i'm going to also increase the specs of this machine a little so that it has enough capacity to run that so i'm going to double my memory and cpu and see how we go with that once that's been updated we can start the machine again and there we go so we can see that we now have vmx enabled for each of the eight v cpus on this host okay cool so on with the next prerequisite to follow along with this video you'll need an os image for your vm it can be a raw disk image or it can be an iso i'll be using an iso for this i just googled windows server trial and got the iso image for the windows server essentials 2019 just from the microsoft site you'll also need a web server that can be reached by the cluster nodes that we'll use to host that os image so this is what my environment looks like in terms of a web server to host the windows iso image or any vm image for that matter i'm just using apache and you can see that it's running here now if you need any help setting that up i'll include the link to the repo that i use to install all of this as well so you can reference that so here you can see i'm on my helper node with apache installed and i just have the windows server 2019 essentials iso that i'll be using to install windows available in the directory bar www.html os now just a quick note on the type of image that you might want to use i don't think it matters so much about the os that's actually being used you can follow my instructions step by step with an iso image of a different os for example and things should work just fine you could even use a cloud-based image if you wanted to as well one that's already like bootable and pre-configured you just need to make a couple of small tweaks and i'll mention those what those small tweaks are and when you need to make them when i get to those steps now the last prerequisite is that you have a default storage class configured and preferably a storage class that supports read write many because if you do you'll then have support for live migration or vms between cluster nodes as well i'll include a link to the video that i made for setting up an nfs based storage class that supports read write many and it's the same storage class that i'll be using in this video okay so now that we have the environment configured and ready to go let's install openshift virtualization we can navigate to operator hub and we can search for openshift virtualization then select install and install again okay so now that's done we can click on it and we need to create a new instance of this openshift virtualization operator deployment we can leave everything there as default and click create okay so now whilst that's installing let's take a quick look at the different components of openshift virtualization i've got a diagram here so as always with everything kubernetes there's a lot of moving pieces that are all connected in some way so don't take this as a definitive diagram of every component involved because it's not but in my opinion it does break the architecture down to three fairly easy to explain parts so firstly we have the components that deal with the vm disk images so for example this could be raw disk images qca 2 or iso images i would say the core component of this section is the data volume resource type which is just an abstraction on top of something called the containerized data importer and the kubernetes persistent volume claim so basically you can define a data volume and point it to a source location that hosts your vm's disk image that can be any of those listed in the image sources box and possibly others as the project matures once that data volume has been created cube vert would then automatically pull in the disk image from whatever source you actually specified and it would do that using an instance of the containerized data importer pod so when that containerized data importer pod is started it's attached to a pvc using the storage class that you specify it's not only responsible for pulling in the disk image that containerized data importer pod will also expand the disk image to populate and fill the pvc to the disk size that you specify and will ultimately result in a disk that you can use with your vm now if we take a look at the containerized data importer github repo we can see that there's a number of options for defining sources for data volumes so depending on where your disk image is located you can pick the appropriate one i'll include the link to this in the description as well okay so that's the disks side of things covered unsurprisingly there's also the resource type of virtual machine so the data volumes that you create can be used in conjunction with some other settings like cpu memory network and other common vm settings to define a virtual machine a running instance of a virtual machine is of kind virtual machine instance or vmi for short and you can see here how a bmi manifests itself on a cluster node so it's just a pod like any other that houses a few specific processes those being the vert launcher process liberty and the qemu kvm vm processors themselves so vert launcher basically receives lifecycle instructions and virtual machine instance parameters and specs from the vert handler you can see on the diagram it's attached to libertd and that's because it's responsible for using libertd to interact with the virtual machine instance also once the vm is in a running state it's vert launcher's responsibility to monitor that virtual machine instances state as well now these qemu and kvm processors as you would expect are effectively the running vm and they're really no different to if you're running the same vm outside of a pod or outside of openshift vert handler as you can see is distributed as a daemon set it's required to be running on all nodes of the cluster that will run vms it basically reports back the virtual machine instance statuses and also watches for any changes with the clusters vmi objects and forms whatever actions are necessary to achieve that required state it could do that for example by delivering instructions to the launcher or it could also do that by instigating changes to the node itself that it's running on if it was related to something like storage or networking now finally apart from managing the vms through the openshift dashboard there's also a client tool a cli that can be used called vert ctl or vert control however you want to pronounce it which similarly to other kubernetes add-ons communicates directly with the kubernetes api server to manipulate cube vert related resources it can be used for all sorts of different things like starting restarting stopping a vm creating services to hit services hosted inside the vm you can migrate vms between different nodes with it and it can also be used to initiate a vnc connection to a virtual machine instance running inside the cluster as well so i'll talk a little bit more about the vert control tool towards the end of the video okay so let's go back and check on the status of that openshift virtualization installation okay cool so that all looks good and you can see that we now have a new option under workloads called virtualization now just before we get to actually creating a vm we just need to do one quick thing and that is set up our default configuration for the qvert settings for our storage class so here you can see that the storage class is called managed nfs storage and i'll be using this storage class for all the vms that i spin up on this cluster so we just want to set up the default access mode and volume mode when we're using this storage class with cubert or openshift virtualization and we can do that by editing a config map if you see cnb occasionally it's old naming that used to be called container native virtualization now the config map that we want to update is this one here cube storage class defaults now we just want to update this section here so that our storage class has the right access mode which should be read write many that also lets us support live migrations and the volume type should be file system because we're using nfs but depending on your storage type this could also be block if we don't set this explicitly it will just default to the access mode and the volume mode set here okay so now that that's all installed and configured we can come back to our openshift dashboard and we can begin to create our new virtual machine so firstly i'm going to change my project to just the default because that's where i want to create my vm and you'll notice now that there's a new menu item under workloads there's this option virtualization so we can select create virtual machine and we can select new with wizard we can give our virtual machine a name and then we can select a source for the vm's image you can see that there's a number of options here so pxe is exactly what you'd expect you can use the network card to pull down and boot an os you don't need a disk for this one you just need to deploy the necessary pxe infrastructure yourself though with the url option it lets you pull a disk image from any http based endpoint and it will automatically create a data volume for you from that disk image so this is good for raw or cloud ready images for example now i mentioned earlier that you don't have to use an iso image like i'm going to to install this vm you can use that raw disk image too so if that's the case if that's the route that you wanted to take then this is the option that you would choose you just need to select it and then enter the path to the raw disk image that you have hosted on your web server so that the containerized data importer pod can pull that image and create the volume for you next up is the option of container so the container option lets you pull down a container image that's hosted in a container registry so that container image can contain a raw image of some sort that will be mounted to the vm once it's been pulled so of course it's still a container so just remember that it is ephemeral and each time that the vm is booted it will pull down the latest version of that image and attach it to the vm and then the last option is disk and the disk option just allows you to attach an existing volume or a pvc directly to the vm so that's the option that i'm going to use there's a really good stream that andrew sullivan from red hat did where he demoed each of these types of deployment so if you haven't already seen it and you're interested in seeing these different sources used i definitely recommend checking that out so i'll include the link to that recording in the description as well then we can select the operating system windows server 2019 flavor is just basically t-shirt sizing for your vm so i'll leave it with custom and i'll give the machine six gig of memory and four cpus and then the workload profile is just a way of customizing the q emu process for a specific workload type so i guess i'll stick with the what's probably the more conservative option which is desktop okay now you'll notice on the network interfaces page that the default model here is vert i o we do have the option if you select edit we do have the option of specifying the e1000 or e1000e nik types to ensure that windows supports that natively i'll select e1000 just because i am using windows but just know that it's not strictly necessary and that's because one of the convenient things that open shift virtualization does for you is it actually attaches a cd-rom with all the i o drivers so that as soon as you boot the windows machine for the first time you can actually go into that and go into that cd-rom and install the virt i o drivers to get that nick working we can select next now ideally here what we would want to do is just add a blank disk and that blank disk would be what we actually install windows to but unfortunately there is a small bug with this wizard at the moment i'm running version 2.4 of openshift virtualization and you can't pass this storage screen without selecting one of these boot sources so you'll see if i select add disk and i just want to choose a blank option you can call this anything you like and let's say we want our windows volume to be 20 gig in size i can select the manage nfs storage and then add you can see here that i can't actually select anything from this boot source so that means that i can't hit next so the workaround for this is to actually manually define a disk i have a gist available for that i'll include the link to this gist in the description below but basically it's just declaring a data volume the source is type blank it has a read write mini access mode and we're using the storage class managed nfs storage and the size of that volume is going to be 20 gig so it is essentially just creating a pvc for us and if we weren't simply like specifying a blank disk as the source for example if we were to specify a url or a container image it would be triggering the containerized data importer to go and get that image and populate the pvc which is obviously using the storage class to create the persistent volume now just remember that because this data volume is an abstraction over a pvc if you were to ever delete the pvc that this data volume creates it would automatically create the pvc again and pull the source back down so just remember that if you're trying to delete the pvc later on you'll need to actually delete the data volume so we can copy that and we can actually check the status of that data volume being created so it shouldn't take too long because it's just obviously a blank volume it doesn't need to pull in an image from anywhere and there you go it succeeded we can actually have a quick look at the nfs server to see what it's done so you can see it's created this default windows server 2019 data volume pvc for us and we can see that the content of that is a disk image that is 20 gig in size we can go back to the openshift dashboard now and we can select add disk and instead of creating the blank disk which is what we just did we can now select attach disk and we can select that windows server 2019 data volume and hit add and now we have the option to select disk 0. i'll just hit next now you can see here that we already have one cd-rom that will be attached to the vm and that is the vio windows drivers that i mentioned earlier now we can attach another cd-rom volume and we can point it to the windows server essentials 2019 image that's being hosted on that helper node via apache so we can select attach cd-rom url and then the url of our apache host i'll just get the name of that image the size of this only has to be big enough to obviously fit that installation iso and then i can use the same nfs storage down here and i'll select add or animate a typo there so if i select next and then create virtual machine what's actually happening behind the scenes if if i go to pods you can see that there's this containerized data importer that's spinning up and that's spinning up so that it can pull down the windows iso image and build a volume out of it so you can see that import is in progress and it's now succeeded so once that's succeeded we can come back to the openshift dashboard we can select virtualization again and you can see that the vm is available it's currently in and off status we just want to click on that vm and we can select details and then we can modify the boot order we just want to add a source which is going to be the cd drive one which i probably should have given a better name i probably should call it windows essentials installer or something but that's fine we can hit save and then i can select actions and start virtual machine and now we can go through all the usual windows installation steps again the virt i o drivers were already pre-loaded by openshift virtualization so we can just select the 2k19 drivers and there we go windows is installed you can see that it recognizes the network card we can install all the virt i o drivers while that's installing we can have a quick look at the vm pod so you can see we have the pod here if we have a look at the terminal we can take a look at the processors running and you can see the processes there that i briefly described earlier now this console in the dashboard is pretty cool but it might not be that convenient when you're managing a lot of different windows machines and that's why you'd want to set up some sort of rdp access you can actually select this here and you can select desktop viewer first we need to enable rdp actually so once you enable rdp in windows you can select this desktop viewer option and it gives you some suggestions about how you can get access using idp or port 3389 directly into your windows machine now how you do this is really up to you you may not want to expose your rdp through openshift services you could also create an additional network interface on each of your vms and put that interface on a management network so you can get access to the vms another way but so that we can play around with the vert control tool or ctl tool we'll give this here a go it's also a good example for how you would expose any other service running on the windows vm as well so i'll copy that but obviously first you will need the vert cto tool you can get that from the release pages on cube vert i can include the link to this page in the description as well and you just have to scroll down a little and you can see here you can pick the installation that suits your operating system i already have this installed so you obviously just need to download that make it executable and then put it in your path so what it gives us by default is a node port service but we can make that even a little bit easier and use a load balancer if you want to see how you can enable that on your on-prem cluster i'll include a link to a video that i created that shows you how to set that up and then here we can just give it a unique port okay and if we have a look at the service that i created we can see it and we can see that we now have this external ip because we did load balancer obviously if you don't have load balancer set up and it was a node port you'd need to stick to using this port here and hit the ip address of one of the nodes in your cluster you can then open up an rdp client and there we go i now have rdp access into the windows host from my mac okay so one last thing before i finish up i just wanted to mention that when i was listing prerequisites for this video i said that a web server was required to host the windows iso image now i could have ignored that requirement and said that the vert control tool is required and that's because vert control can be used to actually create a data volume as well just like we did when we created the blank disk with the yaml or when we pointed the cd-rom to the web server url they both resulted in a new data volume being created so it's possible to also upload directly to the cluster from your local workstation using the control tool to create that data volume and then obviously once it's created you can just attach those disks when filling out the wizard rather than pointing the wizard to where the images are so i guess it's all just preference really and i thought doing it through the wizard first was a better way of understanding what's happening and i think there's also probably a minor advantage in providing a url source to the data volume rather than uploading an image directly because the data volume can then manage that pvc and ensure that the image is always available so for example if the pvc was accidentally deleted the data volume would just go back to the web server and download a copy again of the vm but it wouldn't be able to do that if it was uploaded from a workstation using vert control but if you're in a hurry and you don't want to set up the web server you can use work control and you just want to use this vert control image upload option here where you can then specify the path to the iso or the raw disk image of the qcal image that's available on the local workstation and vert control will take care of creating that data volume for you so there we have it windows running in a vm that's managed by openshift now if you enjoyed this video please hit the like button subscribe and also hit the bell icon so that you can be notified when i release my next video cool thanks again and bye for now [Music] you
Info
Channel: Ryan Hay
Views: 2,428
Rating: 4.869565 out of 5
Keywords:
Id: yfZ6CCwoR_M
Channel Id: undefined
Length: 26min 47sec (1607 seconds)
Published: Thu Oct 22 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.