 Hi, my name is Brian Tannis and I'm part of the Red Hat Cloud Platforms Business Unit focusing on OpenShift. Today we're going to talk about Code Ready Containers, how to run OpenShift 4 on your laptop or your workstation, and specifically within a Windows environment. To begin, we're looking at the GitHub page for Code Ready Containers and we're going to click on the link at the top that takes us to the official documentation to be able to figure out how to run this and install Code Ready Containers. The official Getting Started Guide has a lot of great information. It goes through and talks about what are the differences that you could expect from running Code Ready Containers on your local machine versus OpenShift in a production environment as well as the minimum required hardware that you need to run Code Ready Containers on your machine. That minimum required SPAC would be four CPUs, eight gigabytes of free RAM or memory, as well as 35 gigs of available hard drive space. So make sure that you have that available on your machine before starting, and if you don't, maybe free up some memory or free up some hard drive space, close some applications or what have you. Part of this documentation also talks about that you need a version of Windows that has been updated, and it lists specific details here, so make sure you check out and read that official documentation at the time whenever you're building this on your own machine. If we are running in Linux, it also has some information of some required packages and things like that that you need, but since we're doing Windows this time, we only need to make sure that Windows is updated with some of the latest patches and updates. We could begin by downloading the latest release of Code Ready Containers by clicking on the link and logging into the Red Hat Customer Portal using our credentials. Now once we're logged in, we could reopen that official documentation in a new tab so that it's available to us and initiate the download for Hyper-V on Windows. While we're here, we'll also download the Pool Secret, which is required to set up and run Code Ready Containers. This allows us to have credentials to be able to download and pool things from the official repositories for OpenShift. So I'll go ahead and pause forward while this is downloading and be back in a second. So the Code Ready Containers download is now finished and we'll open the folder where it's at, which is our downloads directory. We'll go ahead and right-click on the zip file and extract it into the location in our downloads directory. Code Ready Containers has been extracted and I went ahead and opened up a PowerShell window. This is just a non-elevated regular user PowerShell window. I went ahead and went into our downloads directory and then the recently extracted Code Ready Containers directory. And in here, you could see there are three files. There's CRC.exe, which is our main executable for Code Ready Containers. There's a doc.pdf that has the latest snapshot of the documentation for Code Ready Containers, as well as a license. The first thing that we need to do here is add this directory into our path so that we could reference Code Ready Containers or CRC from anywhere within our PowerShell window, depending on where or what directory we're at. It won't matter as long as that's within our path. And we do that by specifying env colon path plus equals. And you could see, open the parentheses and put the directory in there. Make sure that you get the semicolon and all that correct. The next part would be running CRC-H or help. This lists all of the available commands. And in here, we could see different tweaks to the configuration and setup and start and stop. We're going to go through and run through a couple of these. So I'm not going to get into too much detail right now. The first step, if we follow the Getting Started Guide, says to run CRC setup. Well, I'm going to run setup-help so that we could see what flags are available to us. And in here, it's kind of important we could see that there is a VM driver available to us. So what if we didn't want to use Hyper-V on our machine and we already were using VirtualBox? Well, I could go and specify VirtualBox here. But in this example, I'm just going to use the default Hyper-V hypervisor to be able to run code-ready containers. And if you haven't got it by now, code-ready containers runs within a virtual machine on our laptop or the workstation that we're using. So the CRC actually goes and provisions a virtual machine within the hypervisor with the specifications that we determine in a later step. Since this is the first time I'm running the setup, Hyper-V is not installed. And you could see the screen blanks out whenever I get the user access control. And I'm just agreeing to both of these that come up. This is going to go ahead and enable the Hyper-V service on my machine. And once it's done, it's going to ask me, please reboot your system to continue. So I'm going to go ahead and reboot. So our machine has been rebooted and I went ahead and logged in and opened a non-elevated regular user PowerShell window. The first step is setting up our path again, since that's only a temporary thing. If you want to make that a permanent thing, then you could go and do so. The next part would be running CRC setup again. And that just makes sure that everything's set up appropriately. And it doesn't hurt to run that two times. Like in our example, this is our second time we're running it. It's just going to validate and make sure everything's okay. The next step would be running CRC start. And I'm going to run dash H here so we could see all the various flags. And in that, you could see that the first flag would be a bundle. The bundle allows us to specify which deployment of OpenShift to use. We're going to just use the default. And I'd imagine this is probably what most people will use most of the time. You can also specify a different number of CPUs available to our virtual machine. By default, remember, the required spec would be at least four, but you could increase that if you need to. The same with memory. Memory by default would be eight gigabytes of free RAM. If you have more available to you and you're trying to run a more heavy workload, or maybe you're trying to work with service mesh or serverless or something like that, maybe think about increasing it. But that's something that you could test out. And if you run into out of memory errors, feel free to increase that if you got the available RAM. You could also specify the VM driver. So if you're using VirtualBox, make sure you do that. But by default, Hyper-V is what's set. And that's what we're using. What's important here is the pull secret file. Out of everything, make sure that you specify that one. If you don't and just run CRC start, then it will ask you to copy and paste in the pull secret. But if you have the file, it makes it a lot easier. And you could download it from that URL that's available in the command, or you've downloaded it already, likely if you followed the same steps as me. So we're going to go ahead and run CRC start dash P and then specify our downloads directory and then the pull secret file. So that's been running for a second. And it's going to go ahead and communicate with Hyper-V. Make sure that we extract the bundle. It's going to configure that virtual machine, set it up, and it's going to start it for us. It will then make sure that OpenShift is up and running and configured properly for code ready containers and what we need it to do. So I'm going to go ahead and skip ahead until this is done. But you should think that this step might take maybe 10 minutes, maybe 20, could be 30 minutes, depending on how fast your machine is, how fast your hard drive is, what kind of applications you have open. So if you don't need something open or available or whatnot, feel free to close that application. That way you have more processing power that you could be able to focus on code ready containers. Anyways, I'll be back here in a second once this is done. So code ready containers is now up and ready and OpenShift is available to us. This took me about 10 minutes on my machine, but again, your experience may vary. The first thing to do is to make sure that there weren't any errors or warnings, and if there were, attend to those appropriately. You could see that I don't have any here. I only have info blocks, but make sure that you check that out. So since I'm all good, I'm going to continue on, and it says to access your cluster, first we need to set up the environment by running CRC OC dash ENV. And that allows us to have access to the OC or OpenShift command line tool within PowerShell. So I'm going to go ahead and run that OC dash ENV, or CRC OC ENV. And in here, you can see that it says, run this command to configure your shell. So I'm going to go ahead and copy and paste that in. The next step says to access your cluster, we need to log in. So we could run the OC log in in pass dash U for user and pass developer and dash P for password and pass in developer. And then the URL, which is just HTTPSAPI.CRC.Testing with the port number available 6443. So we're going to go ahead and log in. It's important to know here, though, that we're logging in as a developer user, which is a non-privileged user. If we need admin access to the console or OpenShift cluster, we could log in with kube admin and the password and all of that is provided for us here as well. So we're going to go ahead and log in. Once we're logged in in the OC command, I'm going to go ahead and open up a console. So I want to open up the web browser console. So I'm going to type CRC space console. And you could see that we need to accept some insecure certificates. No issue there. This is running a self-signed cert. That's OK. So just make sure you accept those. Once you've done that, we're going to then log in using the HT password provider, because we're logging in as developer, just a regular user. But if we're using kube admin with our administration or admin credentials, make sure you choose that one. Anyways, we're going to pass in the username password and open up the developer console. We're now logged in and looking at the developer console. The first step is to create a project. A project allows us to have a space to save the components of our project. We're going to name this one web app and set the display name and a description that makes sense. Now we could add workloads. So we could add a workload from Git if we have a Git repo that has our source code. Or we could use an already built container image from a repository somewhere. We could also specify a Docker file if that's something that we're interested in. But in our example, we're going to do from catalog and use the developer catalog that's available to us in OpenShift. We're going to just run in an Apache HTTP server so that we could see a static website that's running on OpenShift on code ready containers on our laptop. But you could specify something that makes sense for your application if that's what you're interested in. From here, we could specify configuration parameters like the memory request, a Git URL. So if we have different static HTTP website that we want to provide, we could give a repo that is in the same format as the example here. And there's other things that you could specify, like a web hook or things like that. We're just going to leave everything as the default value and click on Create. Once we click Create, OpenShift will create a couple of objects and initiate a source to image or S2I build for the Apache HTTP web server. This will go ahead and fetch the static source code from Git and build everything all into one nice container that has our web server with our source code. This takes a couple of minutes. So I'm going to go ahead and skip ahead to once it's done. I'm going to end up on the topology page. So you could click there to follow along. So our source to image build is now done. And we could tell that because of the color of the surrounding circle within our HTTPD example. There are three different options here. One would be a non-colored circle. And that basically means that we haven't requested an container available to us yet. And one example of one that might happen is during the S2I build. So while the build is running, a deployment config isn't talking to OpenShift and saying, give us one of this container because that container is currently being built. Whenever there's a light blue circle, that means that the deployment config is requesting an additional container to be up. And OpenShift needs to go and deploy that. So it might just take a minute for OpenShift to deploy that. If not, then maybe there's an issue because we're out of memory or something. You could check the logs for details if you see a light blue for quite a while. Whenever you see the dark blue, that means that OpenShift has matched the deployment config. Everything's up and running the way that it should be. So we're all good there. The next step would be to open the web browser and actually access our web application. So we're gonna click the little tiny ba-dot or bubble that's in the top right and that says go to URL. That's going to the route that gets provisioned for this particular application. So we click that and you can see. Welcome to our HTTBD example. And it has some static information on here. Hey, welcome to OpenShift, et cetera. So our application works appropriately. Everything is in a good state. And yeah, now what you can do is start deploying your application locally, right? You could deploy your application in the OpenShift way, test things that you would wanna do to make sure that things are gonna run once you push your application to production all locally on your own machine without worrying about touching and breaking something from somebody else, right? This is all running locally on your machine in that one VM. It's pretty neat. So anyways, what we're gonna do now, since we're done, we've validated the applications up, we're gonna go ahead and shut down our code-ready containers virtual machine. So we're back in our PowerShell window. And since I don't remember exactly the command, I'm gonna do CRC space dash H. And you could see that it's just stop. That stops the cluster. So I'm gonna do CRC stop dash H to see any switches in case there were any. And you could see that there aren't really any switches here. This is just gonna stop the virtual machine. And there aren't any switches because it's already configured. Whenever we set up the start command, we specified all the switches that we need. So issuing CRC stop will talk to Hyper-V or virtual box, if that's what we're using, and shut down the VM. This could take a minute or two, so I'm gonna step forward. So that took about two minutes. Now our code-ready containers and since is stopped. And if we want to, we could leave our environment this way so that we could quickly start our code-ready containers instance later on, right? So if you're planning on using this again later, then just run CRC space start and don't delete it like I'm gonna do here in a second. Well, since I'm gonna show you how to delete it, the next step would be to run CRC space delete. And again, like stop, there are not a lot of command line switches. Everything's configured already. So if I do CRC delete, it will delete our code-ready containers VM. Thank you for watching. You should now have code-ready containers and OpenShift 4 available to develop locally on your own machine. Feel free to check out developers.redhat.com slash OpenShift for more OpenShift 4 and developer specific related content. Thanks again.