 All right, I suppose we can get started. As a speaker, they give us an attendance list. So we'll probably just do like the attendance first. If you guys want to raise your hands if you're here. I'm just kidding. Yeah, we're not going to do that. Hi, everybody. So I'm Luke, home quiz. I work for Red Hat. And today we're going to be talking about this fun topic of cloud native development, which I'm sure you may have gone to a talk today or maybe possibly tomorrow. That is very similar because I saw on the schedule that there was a lot of very similar things. But we'll see if this is any different. So like I said, I'm an engineer at Red Hat. There's my Twitter handle if you want to follow me. Also a huge fish fan. So if anybody is also a huge fish fan, anybody in the room raise your hands. Nobody. Awesome. So if you want to come talk to me later, that'd be great. Also, so this picture here is from 2009. And I realized that there's that whole 10-year challenge stupid thing. So that's 10 years ago. And this is what I look like now in 2019. So there you go. There's the challenge completed. All right. So yeah. So what are we going to learn today? So probably some ways to develop and deploy cloud native applications to Kubernetes or slash OpenShift. That's going to be probably the platform that we're going to use. So we're going to need for this workshop. And it is only an hour long. So we'll try to go quick with these first few slides that I have that kind of introduce some topic or some concepts. And then the second half of it will just be the actual app and doing some things. So you really just need your laptop and a web browser. So hopefully everybody has a web browser installed on their laptop, hopefully. That actually has JavaScript enabled. So that was the other thing. So first survey. So who is a, sorry, did you not have a web browser installed that we were like? No? OK. Yeah. So anybody here writing Node.js applications? I mean, this is a Node conference. So I would imagine I'd see a bunch of hands. All right, cool. Anybody using containers to deploy their stuff? All right, cool. Half full of good chunk people. Anybody familiar with the CUBE CTL, CUBE Cuddle, whatever you want to pronounce it or maybe the OpenShift command line, CLI tools, anything? No, that's probably why you're in the workshop to learn a little bit more about that. Anybody name a handful of Kubernetes objects? No? Yeah, there you go. Awesome. Anybody can name maybe a cloud native pattern or something? No, that's probably why you're here, too, to find out. Also, who do I have from, anybody from Europe here? Anybody travel from Europe, North America, East Coast, West Coast, South America, Asia? OK, cool, cool. Australia? I was going to say, if you travel from there, it's impressive. All right, anyway, that's enough of these things. Right, so some cloud native patterns that we're going to take a look at are this single responsibility pattern, which I'm sure you've heard about. It's like do one thing, do a well, just kind of microservices basically is this. Putting things into containers, having health checks for your app, which is essentially checking to see if your app is running or if it's ready to run. And we'll see examples of these, too. And resilience, something like circuit breaking. So if your app goes down, what you can do to kind of mitigate that and have different fallbacks and that kind of thing. And there's a whole bunch of other things that I didn't really write down on this list because there's a lot. Right, so what is Kubernetes? I'm sure if you had gone to one of the talks today that was about Kubernetes, you've kind of already learned that. Basically, it's a platform for container orchestration and a lot of other cool buzzwords. So I'm going to assume that you guys have a little bit of info on what Kubernetes is. So just to kind of do this workshop and get it moving, we'll just kind of keep going. I just wanted to kind of do this little small overview of some of these concepts that you would use when doing Kubernetes deployments. So basically, you have this. And this is going to work from the smallest thing and it's going to go up to a higher level. That's kind of the way this is going to go. So a container is your smallest thing that you have. And then there's these container images that you combine with your code and that's actually what creates the container. And then those containers are stored in image registry somewhere, something like Docker Hub. If you're using OpenShift, OpenShift actually has its own internal registry where you can store your things like that, maybe Quay, IO, or something else. And then inside the registry, that's where you can store all your different versions and everything of your images. And then basically, that container that we've been talking about gets wrapped in a pod. And that's actually what you deploy on Kubernetes, all right? So what an deployment is, is an deployment is actually the descriptor for that pod saying, OK, I want this many replicas. I want this much CPU or this much memory or whatever. Something I forgot to mention, I am not a DevOps person at all. Like, hate it. If I can avoid it, I will. But so a lot of this stuff is going to be very kind of more of a high level, more of a developer focus than like, oh, we need to boost the memory for this and make this have this many CPUs in this. So I'm sorry if that's what you're looking for in this. There's actually a, not used for JS, people talk tomorrow morning from some of my colleagues, which they go in a little bit more depth there. So if you want to check that out, it's at 9 o'clock tomorrow. Quick plug, right? So there's this other concept of services. This is essentially, if you want to have those pods and those deployments accessible to both sides, then you put a service on top of that. It's kind of like a low balancer. So if you have multiple pods or if you have a particular container that has multiple pods, so you can have maybe three or something like that, the service will connect that and then kind of low balance the traffic to throughout all those. And it's also a way for other applications that you might have in your cluster to talk to each other as well with a service. And then this is something, this is more of an open shift specific thing, a route. But what it does is essentially it lives on top of a service and it makes it have a more readable URL for easier access. Cause we'll see in a minute, one of the apps, how just a plain Kubernetes service works and what you have to do to get access to it. And then we'll see like a route and just see a little bit of the niceties that adds. And then kind of going up the tier a little bit. And then we have a namespace and that's essentially kind of like the grouping of kind of all your applications or all your services. And you can break them up in between, a bunch of different ways between groups, departments, and they're all kind of isolated from each other. Right, so we talked a little bit about Kubernetes and sort of these concepts. OpenShift is basically Red Hat's implementation of Kubernetes. So if you wanted to run just doing plain Kubernetes on OpenShift, you could do that. OpenShift does add some niceties. I'm not a marketing person so I'm not gonna go in and be like, oh, this is the differences and stuff. But it just adds some things on top of it which are kind of nice. And one of those things which we will see in an example is this thing called source to image. So basically, what source to image is is you can basically take your code and take a specialized Docker image and combine them together. So you can take your source code without having to write any Docker files or anything like that and create a Docker image and a resulting image that you then you could then deploy. So if you're doing that on, so this little picture here actually shows kind of like a two stage one. So the first sort of top part is kind of what we're talking about here where you take the image, you take your source code, this build happens and then your application image is essentially just a Docker image there. Right, so then within OpenShift there's this concept of the build. And we'll see that in a minute. All right, so I kind of want to just go quick through that. Okay, good, 10 minutes. So then we have the rest of the kind of the 50 minutes or whatever for this hour to kind of go through this. So if everybody wants to go to this link, this will open up an etherpad. You might have to, I'm not sure if you're gonna have to say allow the, it's a self sign certificate on here. So you might have to say, Chrome might or whatever you're using might freak out. So you might just have to allow the exception. And I'm gonna actually kind of switch in between back and forth because I do have things open. If that's too small, let me know. Right, so you should see an etherpad like this. Let's make it connect. So basically, yeah, so yeah, here we go, the link. Yeah, it's a bit late month, yeah. So basically when you go into that, what you're gonna want to do is, is that good for the link? Whoever asked? So yeah, so when you do go into that, you're gonna see all these users. So if you could just claim one, you don't have to put your name. You could put like your World Warcraft character name. I don't really care. Just so somebody else doesn't use it. And you'll use that username with the password of OpenShift coming up as your logins for things. So right, are people in that or no? Oh, I was just using this too. So this might make the workshop a little harder to do. It could be that the service is possibly down. So basically this is a hosted service that's supposed to be able to open up a terminal and we can do all the stuff within there. So if that is not working, okay, okay. So it's possible that, possible if they might have idled the service on me, which that's gonna be fun. Are you able to get out to, actually out to the internet for me? It's pretty slow. All right, I guess we'll just have to restart the thing, which might take a little time to come up, but maybe we can just go through the slides and then if it does come up, it will be up for a little while. And if we do run it, and I'm sure we'll run out of time, but if we run out of time, the slides should be somewhat self-explanatory. And then like this should be up once we after everything, so. I think you guys are seeing inside stuff right here. Everybody close their eyes for a while and will I take care of this? No, I'm just kidding. All right, let me just, we'll do this, we'll restart thing and then kind of we'll go through the things and we'll wait and see what happens. Everything's still broken, okay. That's probably take a few minutes to start. So we'll just kind of, I'll just go back to this. Okay, right, so what you're supposed to do there was go to this either pad. And what you're gonna do is when all this stuff comes back up, we're gonna, everybody's gonna kind of take one of those users, user one through whatever it is. And it'd be user one or user two, user three, user whatever user number is. Omachef will be the password. And then once that up, we'll actually go to this cool terminal that'll be running and that's where we do all our stuff. You'll see this screen here. It will say, it will start provisioning the stuff and then we'll go into the terminal. And then what we're gonna do is we're gonna log in, we're gonna see who we are. We're gonna go check out the version of the thing and while we're doing that, you know, I'll keep it like this and then we can see if it reloads. It is recent, it's recent. So I'm sure we can talk about something else. And then we're gonna kind of create a new project and that kind of thing. All right, let's wait a few minutes for that thing. So we can talk about something else while we're waiting. You know, how was, what was your, I guess, what have people gone to already? What's your favorite talk that's happened other than this one right now? Has anybody, like anybody from New York? From upstate, nobody? All right, awesome. Albany area? Oh, all right, cool. Sweet. Anybody from New York City? Anybody actually from Montreal here or Canada in this general area, this general area, I guess I should ask, right? Local people, all right, cool. Yeah, locals. My favorite kind of fish. The band. Okay, so, things are coming back up, I feel it looks like. So, yes, okay, awesome. Excellent. Let's see if the user pad thing, yeah. So, we'll actually take a look at that. And this will be a little fun, little experiment, experiment. Open, what is it, node, something, right? Okay, we'll make this bigger. Okay, cool. So, this is a view of OpenShift right here. All these things are pods, which we heard about a few minutes ago. All these other things, all these are applications and that kind of thing. This is actually our terminal app that we're waiting for, and actually it is running. These little circles, when they're blue, it means that they're now running. The etherpad thing, which is here, says it is now running also. So, if we go back to the etherpad, let's see if that comes up. Is it working? Oh, all right, cool. Is it slow? Yeah. But it's working. It is working, okay. Yeah, right, so okay, cool. All right, I think we're back in business here. Which, yeah, awesome. Okay, so when that comes up, like we said before, we're gonna claim the username. Everybody claim the username. If that comes up, which it is coming up. Actually, what the console looks like here. We're not logged in. Yeah, all right, cool. Let's see if I, that was when I created it. So, see when it's light blue? That means it's not up. It just looks like it just restarted again. Okay, so all these pods should be, they say to wait like 15 minutes after everything comes up, but we're kind of just clicking, so we'll see what happens now. You can actually click into this. This is actually clicking. We'll go through this if this ever works, but I've now clicked into a pod and you can actually check out the logs here. If you wanted to, you can update some more logs. Oh, it looks like it is MPM installing some things for the terminal or for the etherpad. This overview of applications, yeah. This thing up here, this route basically, this URL, that's actually an OpenShift route. That's, you could click on that and that makes it the nice, oh awesome, it keeps restarting, which is not great. Can I route? Let's go back to the slides real quick and maybe we can do something else with the etherpad, because etherpad is really just to get our user names so maybe we can guess at it. Can people go, try going to this terminal link? Let me just make it bigger. So when you go to this, I forget, you might have to say allow permissions. There might be a screen first for that before it starts creating. But if it asks you to log in, you can use user and then try. I don't want everybody to use the same user so that's gonna kind of be an issue if we don't do that. There's 75 total. So if I have to, I can be like one, two, three, four, five, six, seven. The console is good, okay. Let's see if, we're a bunch of engineers here. I feel like we can figure something out. Okay, so the etherpad looks like it's working. Maybe, yeah, okay, cool. All right, so yeah, if you go back to this etherpad thing, put your name or a mark of some kind that somebody knows, like if you don't want to put your name, you can just put something on there so you know which user you are. Good, people are filling things in. Yeah, we're all the way down to 75, cool. All right, so people are, are there, no? Okay, so you can be user 30. You're having an issue, okay. So I'll just put take in there. Okay, all right, looks like people are in there and they're doing stuff, which is great. Oh, so the password is gonna be open shift. Yep, oh, sorry, I can go back to the slide so you can see the actual stuff. Right, yeah, so the password will be open shift. So if we go back to here. Right, okay, so once you start getting into the terminal, does anybody need me to put the link for the terminal? Essentially it's the bit.ly link slash Montreal 2019 terminal I think it is, I can go back one. This is just the thing for the terminal, just as a, as a quick whatever. Yeah, so once you go in there, you'll see, you might have to click allow for some permissions. You'll see this thing provisioning. And once you get through that, you'll actually be in the terminal and you are gonna need to log in inside the terminal. So which is OCE login dash U, which is, and then you specify your user, don't actually put user N, the N stands for your number, just in case anybody didn't know that. And then dash P and then open shift is your password. Just gonna kind of click around here so we can see things. You can see in the terminal, people with terminals are getting created. So yeah, so these, so every time somebody logs into the terminal, it's actually creating these pods right here. That's actually not part of the whole presentation, but since everything went to shit anyway, so we're gonna, we're gonna improvise. Yeah, so, all right, cool. Yeah, it's okay. So just, I don't know if everybody's in there, but we're just gonna kind of move along just to kind of get things, get things rolling here. All right, yeah, so you gotta log in. If you do an OCE, who am I? After you've logged in, you can see that you are the particular user that you logged in as. If you use Qubectl version, then you can see that those thing, that command line tool is actually installed. Interesting. Yeah, yeah, yeah, yeah, yeah, okay, gotcha. Awesome. I will give you a dollar, US, after this. I don't know what the conversion rate is. Is it, like, if one US dollar is like a dollar 50 or something Canadian, or is it like the other way? Okay, it's the first one. Okay, okay, I'm sorry. All right, so, kind of moving along. So, you don't actually have to do this next, the new project thing. It's just, that's how you can create a new project right now. If you were to do OCE project, it would say that you're using the user number of your guy's project. If you want to use nano as your editor, instead of vi, do this export command here. But I would recommend doing this export host command. You don't have to put that backslash if you're just writing it all out. This was if you were going to copy and paste. And the slides are on actually that first slide if you were to actually go to it, but because we're going to use this host variable in a couple of examples. So, if we have it set up already, you'll be good. Let's give you guys a few minutes to type. If I come up, yeah. And it's not HTTPS, it is just regular HTTP. Just in case anybody thought I made a typo. Yeah, so if you're just typing it out, you don't have to put the slash in. It was just for a copy, paste thing. If anybody needs me to go back, I can. And so now we're going to open up the web console with the thing that I've been kind of clicking through. So now you guys can actually get your own one. So if you guys want to go to that link, username, password is the same as what you logged in with the terminal. There will be some things where it would be nice to have the terminal and the web console at the same time so we can see some things. Which we kind of saw when we were debugging all this other thing. So yeah, so we should see this thing that we saw. If you go into, it might open up where it's like this catalog of different icons and stuff. So you'll just, on the right hand side, I'll just show you. So when you first open up, you might actually see this kind of view. I would just, you would just go into, you'll have like one thing on the, of course you can't actually see me pointing at my screen. On that, this would be the right hand side. You'll probably just see like user and then the number of user you are. So you just actually click that and that goes into your namespace or your project. Or if you created one on the command line, you could go into that one too. So this is the one that I have, node fun times. All right, so for now, what's that? That, at the moment, no. So that's just for, it will work in a minute. This is, yeah. So that's just kind of a little bit of preparation. Okay. Actually, if you put the, if you put, if you did it as HTTPS, I think it would open up the, that console instead. But we're not, yeah. All right, so, right. We're just gonna try to do, this is a very simple Node.js app to get deployed. So, you know, you might have something like this, very basic express app. I'm sure everybody's kind of familiar with this, what this looks like. So it'll go quick. And then in order to make this into a container, we need a Docker file. It might select, you know, you have some sort of, some version of Node. You know, at the bottom, you're gonna say run npm star or something like that as your command. Just kind of, just gonna kind of go quick here. All right, so how do we get this into Kubernetes? Right, we deploy an image. So here's some things now. Okay, so going back to your terminal, if you guys type this in, this will actually deploy a container that we already have, it's on Docker Hub, with just that basic sort of HelloNode application. And again, the reason why for that backslash or that slash is because if you're copying and pasting this for new lines and stuff, so you could leave that out if you need it to. So basically this is saying, right, create a deployment called hello, and we're gonna use this image, this is the frame edge, and we're gonna use version 1.0.0. One we deploy it. I can actually do that with you. I might as well just follow along as well. I can't copy and paste with the thing. I will follow along with you guys so I kind of have an idea of the timing. So let's see who's, I'm not taking, 22. All right, that was good. I should be able to see the user 22. So if you actually look at the web console in your user, you should see that there is this deployment of what we just did. I'm kind of going back to the slides here real quick. Gonna be jumping back and forth. So we have this deployment. You can do this kubectl get deployment hello, which is the name of the deployment, and dash O is for the output. And if you did YAML, you will see what your deployment is, what it looks like in YAML format. You could also describe it, and that gives a little bit more readable things. For the dash O, you could also do a dash O JSON, and that will output in, you guessed it, JSON format instead of YAML. If you do a kubectl get pods, you actually see the pods that you have running, which should be just the one, which is the one that we just did. And then you can do a kubectl logs, and then don't actually, it's whatever the pod name is, they change. So that, if you were to type that one that's on the screen, it would actually not work, because that's not the pod name. But you can also do that if you're in the web console by clicking in that little blue circle that we looked at earlier, and you can click on logs and check that out there too. All right, so now that we have something deployed, how do we actually expose that, and be able to get access to it? We have to create a service for that. So just doing plain Kubernetes stuff, do a kubectl expose, you wanna expose the deployment with the name of hello. We're gonna tell it to bind to port 8080, and here we're gonna use a type of node port. There's a couple of different types, we're not gonna go into what those are, but essentially node port is kind of the most basic ways of exposing things. It actually, if you don't specify a particular port for your node port, it will, which is different than the port that's there, it assigned you a random one. So in this case, we'll actually be assigned a random port, and I'll show you how to get that in a minute or two. So you can see the service that you created, if you do kubectl get service with hello as the name of the service, and dash o again, yaml, yeah. And now, actually to get the port that the node port, that the service created for us, the dynamic thing, you could do this command. Basically, we're getting the service, and if you were actually to get that service as a JSON output, then you can actually see where it's located. So in this particular, we're using a JSON path. We're saying within that big JSON object, there's a spec parameter. Inside that, there's address port, which is an array. We're gonna get the first element or the zero element, whatever, of that array, and then get the node port element from that array in that returned object. And that will give us the port. If we're using the web console, we can actually, it's slightly easier because it's just displayed there. We can copy and paste it. But if you do these commands and you curl the host which we created earlier with that port, then you're actually able to get the application that we've, the very, very simple node app that we deployed. Anybody that needs me to go back at all, slide-wise, that takes silences, whatever. Sure, there's people still typing that export statement. I'll keep this up, but if you wanted to, yeah, I'm sure you can't see that. But if you wanted to actually, I didn't actually create the service on my end. Everybody is here, sorry. If you ask, oh, sorry, maybe you guys aren't fine. So what I basically, what I did was there's this little service section here. I clicked on that, hello for the service. And then right here is actually what the node port is if people were wanting to go that route instead. This is a workshop yet. I guess I can come around and walk around. Okay, so let's go back to your terminal. Okay, so it hasn't come up with any things at all here. Scroll out here, do an OC or a QPC-CTL get a service. Go back to your thing there and actually do just a refresh a page and just make sure it's still running. All right, well, that's good. That's a good sign. Okay, here, why don't you go back to the terminal thing there. And this was, okay, the service was exposed. Actually, go back to, sorry, the web console. Go to applications and services. And you are, who are you in the butterfly thing there? I mean, she's only, okay, 38, okay, okay. All right, cool. We got that, like, what's time to send? Four, 10, four, 20, four, 10, yeah, okay. So, all right, so one of the, let's go back to the, let's just make this bigger. But easier to do. All right, we'll get to this. All right, so if you wanted to roll out a new version of the application, you can just set the image to basically a new version of the Docker image that's here. And then that will, I'm just gonna run through this so we can get to the actual real application that actually has the cloud native pattern. So, if you don't wanna type this in, it's fine. There's slides and you can kinda work on this later too. So basically what you would do is you would just deploy a new image with a new version and that will actually just update the image, right? And then this is just the way you would clean up. You delete the stuff and basically it's saying that services and deployments are actually independent of each other, so if you delete a service, it doesn't actually delete the deployment, you know, because they're not connected that way. I mean, they sort of connected, but if they can live independently from each other. All right, right, so we deployed a thing, we saw a podge, we saw deployments, we saw a service, we saw how to run a container image in Kubernetes and how to expose that. All right, so now we're actually gonna build a real application here, so okay. So if you're in your terminal, we can clone this repo here. We're gonna do like a combination of like, I'll save it, I won't spoil it. So hopefully most people have that clones, if not I can just wait another few seconds, you know? Okay, if anybody needs me to go back, just let me know. Basically, I'll make this bigger just for this. So basically what this app is, is we're gonna be basically hitting a couple different services and we're gonna basically return this Elizabethan insult, like an insult from the time of probably like the 1600s or something like that, England. So we're gonna be insulted that way. That the way the app is broken up, there's this front end service that's running, that then goes into this insult service that's just a regular node service. That service actually calls two different ones, an adjective service and a noun service to get back an adjective and a noun. And then all that stuff is put together and sent back to the browser. Within each of those, in front of each of those services, we have a circuit breaker that in here we're using a possum.js, which is one circuit breaker implementation, I think breaks is another one. There might be a couple others. Right, so if you have that repo cloned, what we're gonna do is, so you go into that directory, you can cat the deploy, ssh to see kind of what we're doing here. There's a couple, we're gonna do kind of a couple different things here. So the majority of the services, we're just gonna do the regular deploy like we saw from the other app, it's just gonna push up a Docker image that's already been created, and it's gonna expose that, and then it's actually gonna create routes, so we don't have to worry about doing that no port stuff anymore because that's just a pain. But if you look in that file, there's the kind of the noun service has been commented out. That I actually wanted to have us deploy a different way using a tool called NodeShift. Which will do sort of the S2I flow of deploying things just to kind of get a different kind of perspective on different ways of deploying. And so if you run that deploy script now, you should be able to have, it should be pretty quick deploying the front end service, I think the adjective service, and the insole service. And if you do a QPCTL get podged, you should be able to see that they're running. We'll do it all together at the same time. That's not the terminal I wanted. With context switching. In case anybody needed it, here's the get URL again, if I can type correctly. And if you were to look in your console, don't worry about the hello thing, I mean if you still have the hello app in there, we just didn't clean it up, that's fine. So we should see that there's an adjective application running front end, an insole one that's also running. If you are in this view right now, you can, and this is just a picture of that. Before we deploy the noun one, but you can actually, if you're inside the insole and you click on the link to the front end, that should open up. And you can actually, you know, hit insult me. And it gives you a nice insole here. If you do it a couple of times, you'll notice that it's the same thing that's happening. There's something we need to fix with how it's getting to the insole service. Here, we'll just, we'll do that. So if you're actually, so if you go to the, like your web console or the dev console in Chrome or wherever browser you're using, you'll see that it's, the circuit breaker is breaking, so it's failing. And it is because, I don't know if you can see it, I don't know if it shows it in here, but the URL that's trying to hit is a local host, 8080. It's not actually trying to hit, it has the one that we're actually running on our Kubernetes cluster. So we need to fix that. So the way we're gonna do that, I'll go back to here. While we're fixing that, if you want to back in the terminal, go into the noun directory, do an npm run deploy. This will actually kick off the no shift thing, which we'll take a little bit because it's gonna, basically what this is gonna do, it's gonna package up the code that's in the noun directory. It's gonna send that up to OpenShift and it's gonna combine it with an S2I image. It's gonna build that, which means it's gonna do an npm install all on the cluster. Once that gets done, then it will create the deployment, it'll create a service and it'll create a route and it'll deploy that pod and everything will be running. But it'll just take a few, it may be a minute or two while it does the npm install on the hosted service. So if we have that running while we create this external configuration that we're gonna see to fix the issue with it still pointing to localhost. And we'll come back to that. So these were the slides basically saying, hey, look, this thing is broken because it's pointing at localhost. So we're skipping around a little bit. All right, so we're gonna check out this external configuration thing. And we're gonna do it, I do have slides where you do a do from the command line, which is further down. It's editing YAML files and I just very dislike editing YAML files because I don't know where the tabs and spaces are supposed to be on those things. So we're gonna do it from the console. So if you go back to the, go to your web console, and just follow me if you want. Under resources, config maps. And then we say create a config map. We're gonna call, we're gonna name it insult service just with a dash, insult dash service. The key was gonna, now you're gonna have, this is gonna be all uppercase. It's gonna just be insult underscore service. And the value here that we're gonna do is, it's gonna be the, oh, sure, sure, sure, yeah. Yeah. The value here we're gonna have here is gonna actually gonna be the route to the insult service that's running. So, I probably should have told you to copy that first. So, I always made that mistake while practicing this too, so. So we'll just have to do that part again. So if you go back to the overview and you go to the insult thing here and copy this link first and then go back to the resources. Oh, sorry. And we actually can see if you put that in and do slash api slash insult, sorry, I'm skipping around. You can actually see that that's getting, it is getting insults, adjectives, and actually the same noun because I have yet to deploy the noun, the noun thing, the noun service. Sorry. So create config map, insult service dash service, capitals underscore service. So then your value is actually gonna be that route that you copied slash api slash insult. So if we create that, that will create our config map. And now we're gonna go back, kind of back to the overview. And then our front end here, we can click this front end thing to go into our front end deployment. Hopefully I'm not losing anybody. In environment, we're gonna click on add value from config map or secret. This name, we're gonna actually be insult service where it's gonna be capitals. And let's go, insult underscore service, all caps. The resource that we're gonna use is the insult service config map that we just created. And the key that we're gonna use is the insult service key that we created for that too, for that. And then if you click save, that will actually trigger, if you go back to the overview, that actually will trigger a new deployment. And I didn't click back fast enough so this actually redeployed. And we can see that because there's a number two here. That's actually the second deployment that happened. If we refresh the insult, the application page and hit insult may, it should have different, except for the noun part of it, all the other things of the adjectives should be different now. Unless you have already, if you did deploy the noun service, then the noun should actually be changing as well. Right, so for service URL, don't put anything in there. Don't leave. Oh, right. So here, click this add value from continue map for secret, yep. And so from here, we're gonna put in insult underscore service, all capitals, in IN, unless that's what you named it. And then there should just be the the insult service thing. And then the key should just be, yeah, that's it. And then just hit save. Did anybody actually get that deployed and working? One person. All right, that's a success, one person. Now you get two US dollars. All right, let's see where we were on the slides. All right, so that was config map. So that's one pattern, is kind of having your some configurations not necessarily within your app, but in an external resource that you can change. And so every time you change that, then your deployment can happen again, but you're not actually changing code. So that's a good thing to kind of keep things separate. And you should think of pods too, as things that that will die, oh, you know, sort of consistent, you know, not consistent, but like, it's there and they should be somewhat stateless because, you know, they can go up and down like a bunch. So you wanna keep as little, as little state as you can, probably out of in the pod and keep it in these other different external configurations. This just walks through going up. So if you did wanna do it from the command line and you were playing along with the slides and this is just another way of doing it, and you actually have to edit the deployment and edit some YAML and that's why I'd rather do it from the web console because editing YAML isn't my favorite thing. All right. So health checks, which are revival in this and readiness URLs, this is here's another pattern. So essentially, what Aliveness Pro is, is basically checking to see if your app is alive and readiness is something that you can check, just makes you see if your app is ready yet. And with a combination of these, you could actually make it so you have zero downtime when redeploying your app applications. So with all these applications, this particular application that we're doing all the services, there's actually a module called Q-Probe, which if you add that, it'll actually add these slash API, slash health liveness and the readiness probes to your express applications. So you don't have to worry about it because those are the defaults for Kubernetes and slash OpenShift. But if you did have other, say your URL that you wanted to hit or change it up, you could modify that and then when you're requiring, you can do the options and stuff. So all the app, all these services within this Elizabethan install app has this already kind of installed there. So if you happen to have that front end path already in your terminal and you went to these APIs or you could just do it from the web browser as well, you go to those APIs, it should just return okay. That's just the default thing it does, it just returns a 200 okay. But right now and we'll actually do this from the web console because it is easier than editing the thing. So if we wanted to add the actual, so right now those APIs and the URLs, the REST APIs are there on the app, but they're not configured inside the cluster for that particular deployment. So again, if we go in here into this deployment for front end, we could say configuration. Here it actually says hey, you don't have any health checks, do you wanna add them? Yeah, sure we do. So you can add a readiness one. So the path for that would be slash API, slash health, slash readiness. If that's the readiness one, yeah. And then port is 8080 because that's the port that the app, actually applications running on. And then you can just leave, if you wanted to leave the defaults here. Basically the initial delay is saying, how long should I wait before doing this ping? And then the timeout is how long to wait after the counter starts before checking health. Or actually, that's not right because I read the wrong one. Yeah, we could read that. And the liveliness has very similar options as well. So right now we're just gonna add a readiness one and then that's it. And then basically every kind of configuration change that we've been doing here has been redeploying this front-end app. So right now we're up to the third time. So that's why it is a good idea to keep things, any kind of configurations kind of separate there too. So we've actually went in here into the configuration. Now we can see that we have this readiness probe here. And it doesn't have to be a rest endpoint either. It could be like you could tell these probes to run a command from the command line or something like that to see if your app is ready or if your app is still alive. So yeah. So we don't have too much time here so we'll go quick one kind of more concept here which is probably the most important one. And not that, because that's resilience which is the circuit breaking stuff. So we saw this diagram earlier. There's circuit breakers basically before every single app here and here we're using this thing called opossum which has some options. This particular error threshold percentage saying this one says basically if there's 70% of things that happen are errors then we're gonna trip the circuit and we're gonna fail and we're gonna fall back to the error stuff and we're gonna open up. Timeout here is how long, like if we're making a rest call like how long should that happen before we say it's failing? This is 500 milliseconds. So we probably wanna up that possible. And then once things do open it's like this reset timeout is saying how long should we wait to close the circuit so we can try again? And then the name is just naming something it's not really a big thing there. So in this example, this is just a node example here we have this function called get now which gets a URL from some service and if it passes then it was gonna return some data. We create our new circuit and then we say okay on failure we're gonna just output to the console but as a fallback if it does error we're just gonna return, we're gonna call this function that returns this object that says noun in Dung Scraper is the value of the return value. This is actually I think the getting the noun service in the code, right. And then this is just saying hey on this thing we do the circuit.fire which calls that function that we previously so the fire function will actually call the getNoun function there and then do all that stuff. And then we can also do it inside the browser too which it also works and has very similar options. And then in this case and we saw this when our install service wasn't working we were actually getting that as fallback as our return values. So it is, you can use it on just regular node apps or you can use it on like a web front end kind of thing. And then again this is saying when the form was being sent it was firing. So one way we can test that and we sort of already saw it already thing but this is saying and we can do this from we can actually do this from the web console again here. With that example of saying they wanted to take down and I don't have it here so just follow along but if you took down they wanted to basically say let's take down one of those services. So in this case I'm doing the adjective one if you want to do noun that's fine too. So we can actually scale it down to zero. From the command line commands that I can show you again basically doing the same thing. It was saying just the amount of replicas that it should have just make them zero. So this is now zero and so if we do it now the circuit breaker should kick in and it should just do the fallback values instead. And then if you want to bring that particular service back up then you can just click that little button say give me one pod and then it'll bring it back up. I know we're just moving fast because we don't really have any time left and that's saying so yeah basically this is saying edit the deployment file for the noun bring the amount of replicas to zero basically saying just don't have any more pods you test the service and you can see that it's failing then you just bring them back up and the pods start working again. So that's kind of it. So the review we saw very, very quickly and I'm sorry for that that we kind of had that first 10 minutes or whatever trying to get things back into order but we saw some things like we saw deploying with just using the regular vanilla Kubernetes stuff we saw using NodeShift so about creating routes so these different sort of patterns or patterns as my six year old likes to say of keeping things separate in external configurations and circuit breaking and putting and using health checks. So since we don't have any time I wanted if we did I was gonna do this thing where how would you actually do like a modern web application because the application for front end here it's actually some, it's just HTML but it's also being served by it's just a regular web app it's just being served and it's also being served by an express server but how would you do like just like if you were gonna do like a React app or like a Angular or Ember or something like that there's actually we actually have an S2I image that's specific for those kinds of things and you don't have to do this now because I know we're sort of out of time but basically this allows you to this S2I image will take your like in this example it's just this React web app is a basic create React web create React app application that's all it is. And it basically will take that code it'll run the npm build or yarn build whatever you're using it'll take that, it'll take what you've built in that output directory and then it'll actually do, it'll use npm serve or I think technically it's npx serve it'll use the serve module to then serve that code that's one way you can do it you can actually also do some slight modification or add some vibrant variables where you can actually run the full React server or the dev server of that modern web app on OpenShift and then connect your code like an rsync kind of thing in between so changes you make locally they will reflect and that whole kind of loop of making a change locally in it propagating up to the running container and then you can see the changes and stuff and then the other thing that this is great for is kind of that two stage if I'll just go back to it really quick just to confuse everybody here was this, so this two stage thing here because really when you create a modern web app like a web application you're not necessarily it all is HTML and JavaScript it's not necessarily a node app right like you use node to build your things but you really don't use node to serve it necessarily and that's something like nginx or Apache or some sort of HTTP server is better suited for that so this allows you to do this and this is what's called a chain build right here so you basically take your web code which is in the source code in this particular top example with that builder image that gets and you create a new image and then you can take that image with like an nginx image for instance and say because all really the image is is a file system and you can point and say here's where that code was just built using that code and that directory pipe or push that you know put that code into this nginx image and that gets built and that's the thing that actually runs so on your resulting image the image is running whatever you have zero node code at all because all is is HTML and that kind of stuff I've written a few blog posts on that called modern web applications on OpenShift you can Google that or not if you wanted to learn more or just come and talk to me if you want to or you don't have to talk to me at all if you don't want to so I'm actually gonna skip the question section and just say thank you because this was a very interesting interesting thing just last if so I'm usually the person walking around aimlessly because I have nobody to talk to so if you find yourself in that position where you're like walking around because you don't really know anybody and you see me you can just randomly come up and talk to me so you don't have to be in that position anymore just has nothing to do with this talk it's just how things happen at conferences so if you find yourself just kind of aimlessly walking around and been like I don't know what to do because I don't know anybody here and you see me just you can come up and have random conversations and how interesting this talk was or fish or Star Wars or War of Warcraft or anything really yeah so but all right thank you so much for enduring that all right yeah