 But the whole concept of serverless to just kind of get your head around it is to simply basically understand that you're trying to live in this new event driven Ephemeral world and the big way to for people who've been doing development for quite some time That's really really super hard is you're used to basically building an application Let's say on Node.js or Python on flask or WordPress or Django It doesn't matter what you build it in and you're used to running the thing as a process in Linux and holding a port open, right? You hold 8080 open if you're running Tomcat you hold some other port open depending on what the thing is port 80 if it's engine X you know port something else Ruby on rails 6000 you know whatever you hold a port open and that's the world you live in you hold the port open and transactions come into that port Typically HTTP based transactions, but it could be something else. It doesn't matter because it's a port It's a socket TCP stuff comes in and then your thing responds to that that is the world We've always lived in but the difference in this new world is you don't have that anymore Okay, you don't have a socket open a port open you basically are responding to people in real time and but so therefore Somebody else has to hold the socket open by the way Someone else keeps this port open and you just respond to the messages So it's a little different way of programming different way thinking so I put this out There is my third in my series of Bruce Lee movies. This is the way of the dragon This is where he kicks Chuck Norris, but and if you guys are familiar with all the Chuck Norris memes You'll know what I'm talking about so and this fight scene which is available on YouTube by the way I highly recommend you just go watch it because it's funny as hell Okay, so there is a whole exercise setup that I mentioned the demonstrations I'll show you today come from these two GitHub repos again We open source everything and you guys are free and welcome to grab those image content get clone it to your old hard drive Give me a poor request. Give me a GitHub issue if you need to so lots of people taking pictures of that But if you have the bottom link here, you have access to everything, okay? All right, so we're gonna walk you through quickly We'll skip the setup part, but I'll kind of mention how it works But once you have Knative installed it comes in three forms and you'll see this in a second Knative serving Knative eventing and Knative build Okay, and you and in this workshop we would normally take you through the setup set up your first serving So Knative service and understand revisions and configuration routes show you auto scaling We'll show you that here and then we'll show you build and this is for the build-in cluster technology Which we'll talk more about in a second and then eventing which is where you have non-http based input, right? By default serving is htp Eventing is not htp and necessarily and one thing I want to show you before we're done here today Is that the programming model with Knative actually blends the world of functions to micro services If you've done any function-based programming let's say on Amazon Lambda You've seen that the programming model looks completely different than your normal spring root application Okay, that's a different programming model But with Knative we can blend those two worlds enough together where it's actually the same code the exact same code Which is a microservice can now be a serverless service Okay, all right So these three components build serving and eventing do know that build is more or less going away and becoming Tecton and we're going to drill down on that later today with Kamesh All right, so Kamesh is going to really hardcore going to build and Tecton in particular which is the new project that is where all that technology is going But I'll just mention this Understand why build is so important. It's actually so important that it got graduated to its own separate project We have this feature in OpenShift known as S2I sourced image. Let me see if I can show it to you real quick We have a sourced image feature. We've always had this feature I don't show it most of my presentations because it's just something we've had forever and you know I kind of ignore but let's see here if I can show you this Project create a project call this project, you know stuff happens So this is a namespace in Kubernetes. I'm just creating it, but I'm doing it all via GUI. I hit create here You can see I got a bunch of namespaces in this cluster and this cluster is acting up. So let's this cluster is misbehaving Let's go to another one. I've got a lot of clusters obviously and Wow now the network is nice and slow All right, let's create one over here the experience that the technology is basically the same right at the covers So come on create project. All right stuff happens Okay, and hit create All right, come on now you all Stuff happens where to go down here. There it is and Browse catalog All right So I'm showing you this pointy clicky way of doing things if you came to the earlier session where I showed you You know a deployment config with a deployment YAML and we showed you to the cube CTL apply dash F and all that Well, all that's automated by some points and clicks if you have open shift as opposed to raw Kubernetes So this is some open shift does on top all right But I make the point of this because you don't have to do a docker build here You don't even need a docker file and there's a reason why this is important I showed you how to do a docker build earlier and how to run that docker build But you really as an operations people how many operations people we have in-house again Yeah, so we normally get a lot on this Kubernetes side You don't want to give developers the docker build You would love to remove that capability from their hands, you know now the developer especially me We're gonna argue that we deserve it We need to have it as a matter of fact you can't do it for me We will make that argument on the architecture side on the development side But you don't want to give it to them because you have no idea what they're gonna put in that image They're gonna put a Bitcoin miner in there and put it on your infrastructure. You don't even know Okay, but they're getting the Bitcoin you're not But basically you want to make sure you know exactly what's going into that image and therefore the only way to know Exactly what's going in that image is to make sure developers don't build their own images and Put in random things from random sources with all kinds of crazy stuff that's in that Linux runtime It's Linux. What can you run a Linux anything? Okay? So this is a technology that helps remove that skill set from the developer But let them still be productive because the developer they want to build let's say a .NET app They want to build a MongoDB, Node.js app, a Postgres app They want to build a wildfly app, you know, whatever it is here. I'll just pick on Node.js And they want to get going so they pick Node.js. They will basically pick their name So hello will say and and they'll course have to pick their GitHub repo or not GitHub get repo Right, so if you have a private Git lab or whatever, that's fine So they got to figure out where this is coming from and that's all they do No docker file, no docker build, no QCTL ply-f, no creation of a service, no creation of a deployment, no creation of a replica set, no pod They don't have to worry about any of that. I like showing people that because you should know how it works But you don't necessarily want to give the power of that to everybody. Okay, so now I have this thing booting and Let's go over here overview. You can see it's coming online So this will take a little while because it's literally doing a build right now It's building in cluster. Okay, so let's look at builds builds Okay, and latest build and We can even look at the logs for it. So there's it's actually taking the sources Wrapping up with the appropriate docker file that it understands not one it's under operations control not developer control It's doing the build of that image based on the base image one is certified by Red Hat So you know that it's bug-free CVE free Bitcoin minor free etc. And then it'll pop out the other end as a ready to deploy thing But I make this point because Knative build is to make these same kinds of ideas universal across all Kubernetes distributions This is some red hat has always had always had an open source, but no one else ever had Okay, so now it's kind of cool to see everyone else catching up with that So that's really what I'm talking about here So we can come back to that in a second It does take a little while to do all that because it's doing a lot of magic in the background Okay, so that's what Knative build is all about just be aware of that We're gonna spend most of our time on serving which is kind of more exciting thing anyway today And then serving is HTTP based load balancing or scaling So by default you get all those scaling and Kubernetes based on CPU load based on memory load But that often is not the load. That's the problem. The load. That's the problem is all those users click in those balloons Right all those transactions flying at you coming through HTTP That's the load that matters and that's what I want to auto scale on and that's what serving allows you to do That's kind of why it's so awesome. Okay, and the venting as I said is for the same idea, but without HTTP So let's talk about these things and we'll get into this now Here's the key question. I like make sure people understand not balloon popping and game playing But you have to decide if you work for an organization That's in the former category the latter category category if you go talk to three vice presidents of your company right now And there's no one here that's a vice president, right? It's a developer day operations day. It's not vice president day But if you go talk to three vice presidents and you ask them this question our custom apps and API is a key strategic advantage for our organization You're gonna get three different questions answers Often those people don't know Okay, as my fact many of them may say no no you guys are too expensive If I could get rid of all these programmers I would if I could move all that data center stuff to a cloud I would if I could just basically have the cost of IT for this organization. I would you need to find a new job That's the wrong organization to work for and it's certainly the wrong vice president to report up to you want to work for the former Not the latter we are focused and the reason you're all here today Taking your time from the day a day's worth of work and spending time to learn things is because you want to build better Software faster you want to build next-generation applications and API is faster because it matters to your organization Okay, so I love this quote from Albert Einstein We cannot solve the problems with the same thing we use to create them This also means that for people who are mentally in the mode and I see this all throughout the world I'll throw out the world. I speak to a lot of people around the globe if you're mentally thinking right now Oh, this serverless stuff. It's just like CGI been anybody thinking that Nope, okay, you don't have to admit it. I know some of your thinking that okay Common gate we interface is how we used to plug into the back of apps or web servers before there was an Apache web server in CSA so I get that point all the time. It's just like CGI been no, it's not Okay, it actually is very different But if your mental model is this is just like the old crap I used to do then that's the wrong mental model It's actually new crap. You're about to do and have a lot of fun with So if your application that used to get your head around look like this It basically had all these things inside it that we ignored We bundled it up into one big you deploy what unit we deployed it But we had these modules inside of the hopefully we had a nice modular architecture But we started thinking about microservices and our application fades into the background as a matter of fact our application Starts looking more like this distributed things right these components that end up around a network And now we have this network connection across our different components and this is where we start thinking about microservices and of course microservices have to have their own databases because that's the way you give full Independence we're going to talk more about microservices in the later presentations But now you have these multiple points of entry you have these different API calls and you think wow, okay I'm getting my head around Distributed architecture microservices architecture. This is why I need Kubernetes and OpenShift. I agree This is what people are interested in but look at this quote here by this pointy-eared fellow. He's not an elf by the way You Lord of the Rings fans Okay, the problem is you know all these microservices Oh, what actually slides got out of order again. So changes the essential exist process of all existence This is the problem. We're living with now from a serverless architecture standpoint We not only have these long lived microservice processes. We're now going to have these short-lived executable serverless processes Okay functions you might say things that pop to life do their thing and then go away Okay, so it does change the nature of our architecture. So let's kind of go through that real quickly This is just stuff you can read on your own But there is a slight distinction between serverless and FAS so function as a service is a very specific concrete implementation of Function execution within something like Amazon Lambda, you know Google Cloud Function open whisk if you're from IBM Etc. Etc. We're going to deal more with the serverless aspects not the function as a service aspects here in this presentation Serverless by the way, it's been around a long time We've not we've been thinking about this for quite some time as a matter of fact the term was coined in 2012 If you remember earlier, I showed you the history of microservices Serverless has been around a while too and here's the part that's actually going to be hard for us as IT professionals We're still trying to catch up on the oh, we got to do containers We got to do microservices we got to distribute computing and this another paradigm is coming right on top of it Serverless at the same time. So here you are learning one thing and the new thing is already, you know past you It's the nature of our industry at this point things are moving ever faster. Okay ever faster So the key question to think about when it comes to this architecture Is there a service I can use versus one I have to build if there are Java people in the room This is going to hurt your feelings Java people want to build their own databases Java people want to build their own message brokers Java people want to build their own MVC framework They want to build their own dependency injection framework. They want to build their own ORM Because they came from C++ people who did all the same things But no, that's not the way we should think anymore There's dozens of those things in open source for ORM MVC dependency injection Messaging broker technology like Kafka MQP based on a MQ based on active MQ things like that Use those things don't rebuild them. So that's really we start thinking serverless because it looks like this You're gonna have HTTP input and output. You need some form API gateway You're gonna have some form of SSO that you're gonna need to take advantage of don't build an off server yourself Get one as a matter of fact. There's a great one in open source. The Red Hat sponsors called key cloak Wonderful service you can basically stand it up launch it as a pod in your Kubernetes And now you have OAuth but single sign-on across multiple social providers, you know Facebook login GitHub login all that for free You don't have to do anything. It's part of it. Maybe you want some form of storage. Well, why would you recreate? Amazon s3 Why not just use Amazon s3? So it's a different way of thinking you want a database go find a database make it run as a service You want to cash? Don't build one Java people. There are plenty of good ones out there make them run Messaging again, we talked about messing also push notifications or SMS and text messages How do you notify a user asynchronously? These are all things that are out there Now what you do is you fill this in with your business logic now Okay, now you add your custom value add capability to these services that are out there You don't recreate services that you can just use you build your own stuff on top Okay, you have long lived large chunks of code that add your business logic your business value And those might be microservices and then you connect the dots via these serverless function things In other words, you have these event-driven components that can be rewired across the architecture And of course all of that supports an API that is consumed by your business partners consumed by your desktop consumed by your mobile devices and your users So your back-end architecture might look like that going forward And so this is actually going to be very interesting a lot of people have started moving in this direction I was talking to a young man earlier today basically is all on Amazon Lambda and doing this all on Amazon But of course, you're now fully locked in to Amazon if you do it that way What I'll show you is you're only locked in to Kubernetes and the good news is if you saw the demonstration earlier Kubernetes runs everywhere So at least you can run across any cloud private public in between it doesn't matter Now a couple of things to understand about your serverless functions versus your microservices long live versus short lived This you want to keep up all the time hold that port keep stay on that port stay on that process You actually take great pride in knowing that your application will stay up for you know Not just hours but days. I'm kidding You actually take great pride that the thing stays up for weeks and months and never has to be rebooted That's what we do on the Java sidehouse for sure Maybe we have to reboot that Node.js process a little bit more often We love the fact that JVM can run for months with no problem, but it's different over here that process will last approximately 90 seconds to five minutes Depending on what architecture using 90 seconds to five minutes So you don't have time to properly warm up the JVM in that setting So this is why Java has not been part of the serverless opportunities that are out there This is why everybody again in the serverless world is migrating to Python node or go And that's another reason why we did corkis because we can be as fast and small and warm up instantly and run and Incredibly fast as a matter of fact. Let me show you a demo of that instead of preaching at you so much Just maybe get a make this more real Here, let's see if this system will run for me. This could go very badly because again that cluster is acting up a little bit But here I have let me do cuban s. I Am in this side-by-side namespace on this system And again, I could go to the GUI and we go digging into the GUI to see if we can find it Let's see here. Let's go here. Well, actually, let's go view all projects. Oh wait. I'm in the wrong system over here I have too many clusters Side by side. Here it is. Okay, and so if you can see there's nothing running there right now Okay, there are these one of those things. Oh see that says zero pods There are no pods running. So when I say Qctl get pods Get pods. There are no pods running Okay, because this was architected to be in a serverless setting So by default, it's not a microservice that's always on it is something that comes on as needed So let me actually put a little load to it So let's go to this corpus application and I'm going to send in a burst of load with a script here It's using a tool called siege which we tell you to install if you run our tutorials and it's running 40 concurrent users right now So a burst of users to shot in and it's just a curl command. By the way, it's just HTTP, right? Shoot in and what Knative is doing is saying holy crap a whole bunch of people are coming Let me launch four servers for pods to respond to that 40 User load and I did this on purpose by the way. I made the concurrency 10 So that's one thing that's different than let's say an Amazon Lambda architecture versus let's say this architecture You have control of those kinds of dials and knobs You want you can set the concurrency not greater than one by default most function of the service solutions concurrency is one One transaction one thing runs. I actually set this to 10 So therefore 40 transactions creates four things to run But watch what happens if we just talk just a few seconds longer K native is clever enough to know well that burst of load when I actually was just an anomaly I don't actually need to keep all four of those running as a matter of fact. Let me go ahead and keep something running here Okay, I'm actually gonna keep hitting it but look two of them already being torn down So the memory and CPU used by those now three are being torn down because one of those Java based applications Can handle a single user Polling away it could actually handle the 40 users again It's just so happens that you can put it in panic mode if it's totally asleep and you hit it hard fast It'll try to scale quickly to the point and again you can determine how much you scale But in this case it's tearing it down and it'll leave the one up And if I actually stop this polar it'll eventually tear that one down to 90 seconds is the default Interval for that and let me also do the same with my Node.js application here. All right, so let's do the burst on it Okay, and again, it's just going to throw in the 40 concurrent users But here's the cool thing Anything you can put in a pod is now treated this way You got a 4-tran application a cobalt application C++ app doesn't matter K native doesn't care because it works off our container. It works off Kubernetes architecture So literally the burst here is starting for Node.js Just like it would anything okay, and there it got one of them up and then again, it'll go through the same process It'll realize I didn't need to panic. I can handle more users and it'll start tearing them down Again, even if I actually send in a second burst, so let's actually send a second burst Dun-dun-dun, okay, so here's a second burst. You notice there's no latency there No cold start latency because one thing is already up So as long as something's up to respond It doesn't hold that load. It just sends the load through if nobody is up It holds the load long enough to basically get a pod online so it can send the traffic through and get responses back So just keep that in mind right you just have to you just have to be aware of it One thing that's actually very popular is to end this space is to not set the default floor The bottom to zero but set it to one So no users ever waiting One is the low end but you then want to burst out to maybe five or ten or whatever need Whatever you need when all your users show up on Monday morning and I'll log in and run their first transaction If you deal with New York banks nine o'clock on Monday morning is a heavy load When the door is open and every trader and every person and teller etc. Logs in all right If you so depending on what world you live in you're under heavy load under different points of the day so you need to scale for that load but You do no longer have to scale for that peak load all the time So once we're beyond peak Release those resources so other people can use those resources now. I've seen now. I'm no longer running all those pods I'm just down to two Well, maybe I can run my big data workload now my big batch job for Hadoop because I got a extra CPUs and memory So that's the way you have to think and that's why you care about this kind of architecture is this simple thing But let me show you this. I didn't show you guys this already, right? Make sure I don't think I did so let's see here All right, let's check this out This is no JS memory Yep, so no JS memory. We'll zoom in here a little bit. It is running We're you know under 28 megs This is quarkus. All right, so you can tell by the name Okay See who says quarkus there. It's the pod identifier. So where'd it go? Quark, yeah, I call it quarked so Java is a lot smaller than no JS right now. Now your mileage will vary Every time I run this the numbers come up slightly different So normally Java smaller than node Java's faster than node area now then node catches closest to gap But otherwise it's pretty consistent, but they're pretty close. All right, so here I am at 20 meg versus 27 meg 7 megabytes doesn't mean much But the important thing is this is Java that's running that fast and that small. Okay here. Let me run something else Let me run a more traditional Java stack Go over here. Okay, and let's just run one of those so we don't have to wait for four of them to start But again the same thing is just a curl command that's coming in and you can see it's running my little spring boot app It'll take a little longer to get started because it is a normal JVM And you'll see that coming up, but let's also go ahead and check out our memory requirements and What's this? Is this the boot one? I'm double-checking now. That's still the node one So it hasn't picked up. It hasn't been picked up yet Because it's not even up yet. All right, so Okay, come on live it. There we go Now it's up and now we're over at a hundred and something megabytes So we're four times larger than the quarkus application just in this one little use case So it's and depending on what you do it actually the savings gets greater Okay, like if it's a real database application with an API you can get greater savings. This is just a little world Okay, so I make this point This is a new way of thinking a different way of thinking your event driven You're responding in real time and you want to write your application a little bit differently Now what's cool about what k-native does is you don't actually have to change your code base much Let me show you what that looks like. Let's see here Yeah, let's bring up the code base here for the spring boot app Okay, notice it's just a get mapping if you're familiar with spring boot if you're with micro profile or something There's just at get or at post so at get mapping at post mapping if you're spring syntax But all you need is a post that basically receives a cloud event JSON That's it. That's the nice thing about k-native You don't actually have to write your code in the Amazon lambda way or the IBM way or the Microsoft way or the Google way You write it the normal way and k-native still gives you that awesome auto scaling that you would have get from those other platforms So that's what I like the technology so much So, you know, you just have to deal with this JSON chunk now That's all all right because and you only need this by the way if you're not using HTTP Because what happens is it's bridging those events into this method So it could be a Kafka message coming in that's why it's the JSON chunk right there So if a Kafka message comes in FTP message comes in, you know text message comes in whatever it might be okay, let's get back to this and Yeah, let me turn these guys off and Dun-dun-dun and you should see actually our quarkus one's already gone The other two were still hitting so but they'll they'll fade away after about 90 seconds. Okay We'll come back to that in a minute and Talk more about it. Okay, let's see here. Where do we go? Okay, so that concept of a short-lived process versus long-lived process a new programming model a new programming model is true If you're living with Amazon Lambda something like that k-native that blends the model It is event-driven async so you have to be aware that your component is waking up Doing everything it needs to do and then going away very different way of thinking from the old way Built java e applications spring boot applications the way we built node. Yes applications. It doesn't matter We're no longer holding a port. We're no longer keeping a process up We no longer have a big old connection pool We built to the database a big old thread pool a big old cache because it's ephemeral It's gonna go away and within 90 seconds to five minutes. All right, keep that in mind now I do say that microservices are very mature We actually have been building applications like this for 20 years Microservices paradigm is just slightly different than the old monolithic paradigm where we had before The service paradigm is fairly different. It is a different way of thinking But we had ID integration debuggers tracers monitoring We had all that figured out CICD in the service world. It's still kind of new. We're still figuring these things out How do you debug the thing that comes and goes because a debugger normally attaches to the process connects to a port? Except expects that port and that process to stay around a while as you walk through the breakpoints on it What if you don't have that? Now the cool thing is with k-native because the programming model is the same You can actually start it as a microservice do all your work against it and then flip it as to a service function Let me actually I'll show you that Because I think that's actually a very cool thing and I actually don't show this to a lot of people But let's find make this work. Okay Because on the on this application. I'll just go back to a quarkus here If you actually look at the code base and it works It doesn't matter what it is if you look at my code base here I actually have different ways of deploying the same application. So here's my application again Quarkus is based on micro profiles at get at post things like that, but I also have a regular deployment and a regular service To deploy it so in other words, I can deploy it as a normal microservice. I don't have to do anything funny about it So let's try that real quick. I can basically come over here now if you saw our earlier presentation This is in q-files. I could say qctl apply dash f q-files. I can do this the old school way deployment and Notice this to deploy the quay I own one I noticed by the way all my pods are gone because we talked long enough that they disappeared But here's now the old deployment model. This is not the Knative deployment model. I'm using a different YAML file I'm using a traditional deployment in this case and qctl apply That chef cute files and there was the service YAML Okay Morning Yeah, you're supposed to create with that get sir. Let me see what it did though They create okay, maybe not Here we go. No problem. It helps if you spell create correctly and All right go go go No, I did create so get services. Oh That's cuz oh, it's got the I have the other old one there too. All right. Hold on. I can fix this Give it a different name there we go There we go and Right I'm gonna match it So I'm just trying to get this the in sync and so it doesn't overlap with everybody else So that's fine there and actually let's go ahead and give this my sweet consistent. All right, so qctl get deployments As you can tell I'm just kind of a hacker. Is that not obvious? Come on qctl get deployments Dun-dun-dun-dun All right, so we're gonna qctl delete deployment. Let's delete the quirked one Cuz it overlaps with the name from something else So we don't want to do that and let's try this again notice I deleted the deployment so that one's going away qctl apply Ashef q files. Let's do that point again And I'm you I basically oh man. I made a typo in here someplace Where did I typo it? This is the one problem with yambles All right You guys see the error made these all look good. I Don't think I messed that up and you can see though where it's pulling from I don't know you know what it doesn't like uppercase Yes, I always forget that you know, I'm old-school. I think camel case But you shouldn't use camel case. Let's see here Qctl apply dash F and Q files and then yeah deployment. Let's see if I got it right this time There we go, and we should see that pod come to life now. It says quirked burr Let me go ahead and fix my service though because I had a camel case there, too So there's a good tip for you don't use camel case and my brain is so wired for that because you know too many years in programming, right? So create dash F files and then service All right. Come on. All right. So the service is up qctl get my services Rep quirked burr So what I did though is I just went through a normal deployment and look it does have actually a public Address already. Let's see if that'll work for me curl and No, no, no, no, let's see here Well, let's do this OC expose service quirked burr. Let's just get a route out of this thing Come on now But this is a normal deployment a normal microservice deployment qctl get routes You notice I switched to OC there because routes are again Specific so so in this case it gives me a nice URLs. Let's try that curl. There we go So there's the application running as a microservice. It won't scale down based on no load It'll just stay up and running all the time living on that port living at that end point and and so that's the cool Thing is your code runs that way or the Knative way Okay, because the Knative the only difference is I go over here again. I have a different set of yaml You can see I use it here. It is a kind service, but look at the API version serving Knative dev So it's a different type of service and you when you deploy this service. It actually does a bunch of interesting things Okay, so let me actually tear down the deployment Let's get rid of it quirked burr All right, we'll get rid of that one and the service as well. Just go and just remove that our way and Watch this QCTL get deployments are actually More fun to Ctl Get deployments Let's watch it so you can see I actually do have three deployments here I didn't create them though. I created Knative services which created deployments So like a deployment creates a replica set creates a pod We now have one more abstraction layer further up that hierarchy You create a Knative service which creates a deployment which creates a replica set heads pod Okay, so you can see there's three deployments here, and if I come over here and do Qube Ctl Get case service. I now have these things called case services So this is actually a pretty advanced idea. Let me kind of drop this on you This is a command you need to make note of Qube Ctl get CRDs Always run that command on any cluster you talk to it should normally come back with nothing But often it'll come back with all kinds of stuff CRD stands for custom resource definition. It allows you to extend the schema of the API You can basically load of CRD into your Kubernetes cluster It's amazing feature by the way, and now you have new schema new object types new kinds that you can deploy against So to really maybe to make that point a little bit more aggressively here Let's see here Okay, Qube Ctl Get Pods where am I at? I'm still well who am I connected to? Qube Ctl get namespaces. Maybe this guy's no longer connected. No there it is Okay, so and still at side-by-side, so let's switch namespaces real quick Create well Qube Ctl create Whatever namespace Whatever Let's try this for a second Qube in s whatever and all right there we go. We've flipped over Qtl get all There's not much running here except you'll see some k-native stuff and you can ignore that for now Oh, come on get all sometimes very slow in this cluster. I don't know why We're not gonna wait for it. Okay, Qube Ctl get CRDs grep Kafka I Have a CRD called Kafka that means I can do things like Qube Ctl get Kafka's And I can deploy Kafka's let's try that real quick Here and here and here didn't do Let's try it real quick just to make the point of what a CRD will do Let's gonna show you what that looks like. I want let's say I want Kafka Here's hello Kafka notice the kind says Kafka and Arun I'll just pick on a different person here. There's got to be an Arun in the room, right? I just say that because I have a lot of friends name Arun But now I have that Arun cluster and I can say Qube Ctl apply dash F Qube files and there was it was called hello cluster was the file hello Kafka watch Qube Ctl get pods Watch what happens here? Okay, Qube Ctl get Kafka's Now we have an Arun cluster Kafka object. I can do the normal things I can describe it I can edit it. I can talk to it Arun cluster like here's that editing thing. I showed you earlier so there it is that's the Kafka object in the in the system now and Yep, I didn't make any changes. Oh, this is a little slow today. This cluster has gotten a little slow on me But if we wait just a few seconds longer I know why it's so slow. I scaled it down. That's one problem and you guys might know I not know this is a I decided I didn't want to pay so much money, but you know and thought about it and This actually will take a little second or two, but let's add a couple come. Let's add a couple servers to our mix Yeah, come here all projects. Yeah, I took I'm down to almost no servers. So let's kind of crank that up Okay, let's add a couple more servers to the mix. It'll take a little this system has got some issues There we go, but it'll take a little to bring up those servers But basically if you watch on the Amazon side right now, you'll see some new servers coming online. Let's see here It and it takes a few seconds And I added them an AP South a so it'll take us a little seconds to bring those servers online But let's see here if this will finish man. It's really slow for me today But basically and it might be that we're out of resources on the cluster But what you'll see is zookeepers free zookeepers free Kafka brokers starting based on the fact that I declared a new Kafka object So understanding what CRDs do for you because that's basically how Istio is implemented That's basically how K native is implemented Cube CTO get CRDs grep Istio Well, it helps if you spell Istio correctly You can see there's a bunch of Istio objects And if you sat to the Istio session you worked with these virtual services You worked with these destination rules in the case of K native get CRDs Grap K native you work with a K native service K native And you can see there's revisions routes serverless services Services those are the objects you're now dealing with so you can deploy those objects into your Kubernetes cluster Then in a very simple way. Okay, so We have here. What was I doing here? Okay, there's my deployments Qtl get pods Oh, I'm in the wrong namespace. Let's see Okay, we'll come back to you in a second. All right, let's switch back to the right namespace side by side Okay There's our three deployments notice it says zero of zero because we don't want a pod running right now But if we apply some load, let's hit this guy over here The Node.js guy watch what happens zero of one is ready. We need one because we have load coming in So what K native is doing is simply manipulating those values the replicas if you were in my earlier session I showed you how you could manipulate the replicas. That's what it's doing Okay, the thing that's clever about it is it knows to hold the inbound transaction The user is not getting an error It's just hold it is holding and it's going to wait until we eventually get something up to respond to that user And so you'll see it's going through its full lifecycle here You can see it's zero of three by native by default K native has two sidecars the Istio sidecar and the K native sidecar You can of course configure it with only one sidecar and actually that's what we recommend If you're not using Istio for K native don't add the Istio sidecar The Istio sidecar actually is a little bit heavier than you might want especially in this dynamic auto-scaling world All right, so we actually will recommend turning that one off But I want to show you the three by three here because there are two additional sidecars added You can see we're now one by one here. We're getting user responses if I stop the load You'll see this go back come back and say oh you don't need this pod anymore So that concept of manipulating the deployment that we showed you earlier with regular Kubernetes still applies here It's just K native is doing that now as opposed to you manually That's the difference instead of you the operations team changing the number K native is changing the number on your behalf So if I stop the load we wait 90 seconds it goes away that by the way is configurable And I want to I want to see if this actually came online. What was the name of that namespace? It was whatever right? Man I got to go back and figure that out QCTO Get Kafka's Yeah, so the cluster is there and it's four minutes old so those should be coming to life. Okay, we'll worry about that later Okay All right, let's get back into this Let's see. I'm wondering if those two servers asked for are they coming online No Something's really wrong here Okay But let's go here Okay, let's kind of we got about 10 minutes left this kind of rock and roll through the rest of this So the way to understand function as a service is there's a number of functions of service engines running in the Kubernetes Ecosystem you might have heard of Apache OpenWisk by the IBM team FM project from the Oracle team Rift from the Pivotal team open FAS is just an open source project run by a guy named Alex, right? But these are the more popular ones you see in the ecosystem and they can all run on your Kubernetes cluster as a matter of fact The Red Hat team help help Bring open with to Kubernetes as an example. We did a lot of engineering effort But these are all different players that are out there in the ecosystem So why did we do this thing called Knative? All right Why did Knative become born because and it was born a year ago by the way in July 24th 2018 but why is Knative here now when all this other stuff existed is because they were all doing the same thing Again and again and again in the words They were all building a solution to build an image on the fly They were all building a solution to autoscale on the fly, right? They're all dealing with event binding They're all dealing with observability So why not bring all that commonality into a central project open source project that everyone can collaborate on and Only worry about the special sauce on top So in other words all those function as service providers can then build the function programming model They want they can build a developer experience with a clean CLI that they want They can add event sources that will connect to all kinds of cool things on their back-end systems and add value there But the stuff that's shared across all those functions of source players should be shared a shared library It turns out that in the year that we've seen this project being born is not really played out that way all those independent players Still want to be independent Okay, but at Red Hat we're looking more at this from the global good and we like the shared aspect of it So we're focusing more on k-native. All right, and that's just where we are right now So criminals based platform for serverless workloads. These are base primitives So if they're parts of this you feel are better rather clunky or harder to use is because they are primitives You're supposed to build on top of this architecture And so the most advanced thing is that serving thing I just showed you it's easy to use You just have to clear the right serving yaml and you get it for free, right? It basically scales up scales down that kind of thing. All right scale to zero scale from zero That's the part that people really like in this architecture You also have the concept of configurations revisions in other words, it's it's every time you make a change It's keeping a new revision in its architecture So you can actually roll back very easily you don't have to do that manually, right? You can you always do that with a blue-green deployment with different deployments and old school Kubernetes But this one kind of has it built in out of the box. You can always roll back from a revision to revision They also have the in cluster image building which you'll hear more about when you my kamesh talks about tecton and of course traffic splitting You can kind of see what it looks like here. It is it does early on it was based on Istio, but as of right now the Knative team is splitting from the Istio team and not making that a dependent scene any longer Simply because the fact Istio does all kinds of really awesome stuff But often you don't need all that awesome stuff in a plain old serverless architecture Therefore you shouldn't have to pay for that overhead It's kind of the idea and we've actually benchmarked this a lot and demonstrated there are many opportunities to split those worlds Okay, again, this whole thing is a bunch of exercises you can get at the bit.ly Knative tutorial Definitely check that out and you can do this thing hands-on Kamesh wrote the tutorial so you can actually try it out GitHub but just to show you the get crd thing remember that Remember that command qctl get crd then you know what your cluster has available to it What are the extra things it has you can see this is the ones we're serving and Here's you can also edit the config map to change auto scaler though. This no longer works by the way So it used to be that you could edit the config map and change the auto scaling behavior that doesn't work anymore Though it's still on my slides because it was awesome cool thing to show you I could actually change the concurrency value change the scaling value that doesn't work So but here is what you would deal with in a old school Kubernetes deployment replica set Service that gives you pods right I just showed it to you again I could basically take any image a deployment in service and make it a microservice right running inside Kubernetes Here's what it looks like when you add Knative on top your deployment is still here your replica set is still here Your service is still here your pods are still here. It's just that now Knative is in charge It determines when that deployment is created when that service is created when those pods scale up and show up That's all that's really the biggest difference and there's this other infrastructure here so it actually holds that load as it comes into the architecture and Basically causes all those other things to spin up dynamically on command. Okay, that's what the auto activators for and the pod aller scaler and Let's see here. There is the Knative build which you mentioned earlier, but we're gonna skip that for now There's a bunch of cool things you can do there But that's what you'll see in commissions tecton talk and let's just talk briefly about a venting Eventing is where again if you don't want HTTP auto scaling you want Kafka auto scaling That's what you would have here. All right, and the trick is it comes to that post method again You just have to have that post with the cloud JSON that I showed you All right a bunch of resources. Let's go back and look at a couple more things though. I want to see a Couple more things here one. I'm curious to see if that Kafka thing came online Because I'm wondering why and whatever ever Why it acted up on me to do didn't get pods No, interesting. So cube CTL Cube CTL get Kafka's I'm one of this works. Oh wide Now let's say get Kafka's And then didn't turn cube CTL get Kafka's turn turn Right describe It looks okay Something is definitely going wonky here But the whole concept and what I was just trying to show you with that is that simply that the yaml You throw at it like this one right here where there'd be a Kafka one or it be the k-native service one if I go back here Here okay, you can basically it's just the yaml. That's the difference right so you basically say I want a k-native service and Also, you'll notice that everything in the spec section looks just like a deployment It's actually the same syntax as a regular old deployment You can copy and paste your deployment into this section and then you get k-native serving Okay, so you can kind of see it's the image. It's the resource if I get in my earlier presentation I showed you image resources liveness probe readiness probe all that same stuff applies So you can basically copy and paste that so if I go here to my like my deployment See it's it's gonna be identical from this point Okay, so just keep that in mind this stuff would be the same between those two worlds right there Okay, and actually by the way this Because k-native is still zero dot seven it's still changing it's breaking back into compatibility So you got a bit better than mine as a matter of fact This syntax has changed slightly here in the latest version We just haven't updated yet and you can also see this annotation for determining the concurrency value remember earlier I set 40 requests in and four pods came to life that's set by that 10 right there Okay, if I make that number one you'd have 40 pods trying to come to life And so by default a normal serverless architecture that number is often one right in the Amazon Lambda world That's how you should think of it However, we know that a nice node.js app or a nice Java based app can handle a lot more than a single user So I made it 10 but honestly the default value is a hundred in k-native 100s actually will work fine right a Java based app can handle a hundred concurrent users no problem I'm no.js app can handle concurrent users a flask Python app Maybe not and I can say that because we tested some of these things So just bear that in mind flat Python G unicorn no problem right So just keep that in mind that you do have to think about that You should also remember how long the job takes to execute a request So in other words if you actually and you can test this with Java in your application put in a bunch of Sleeps put in a sleep for two minutes So that actually will create a greater backlog of transactions because this job is taking so long And that doesn't it have an impact on your concurrency scaling value here If you have a job of tasks that takes two minutes to execute because it's doing all kinds of crazy stuff Gathering a bunch of data running an inference engine for AIML and this is specifically where I saw this right I was running a inference endpoint. There was a machine learning trained model It took a lot of memory loss CPU and took a while to respond in that case You know, you might actually have to make your currency value a little bit lower because this job takes so long You need another pod to spin up to handle the next request So you can test it easily like I said by adding sleeps into your code just to see the the changing of behavior here Okay, let's see. We're okay. Let's go and wrap up or at least open up for some questions There's a bunch of resources you should be aware of commission has written a bunch of different blogs You should check out. There's of course the database book. We mentioned microservices This was actually done by it's in yinaga if you have a monolithic database do consider what it means to work We're working on microservices world grip great tips and techniques there The Istio book we mentioned earlier and you've seen all these books that we talked about earlier. Okay