All right. Well, Paul, our first experiment with a live podcast recording is going well so far. I had like 15 minutes of futzing around with stuff, despite the best intentions. But here we are. Why don't you introduce yourself? Sure. My name is Paul Tchaikovsky. What do you want to know about me? I'm originally from Australia, as you can tell from the accent, but I live in Austin, Texas. What did they say? I wasn't born in Texas, but I got there as fast as I could. That's right. And then I got stuck there and I couldn't leave. So we're here in Charlotte at the SpringOne Tour. I always want to say Spring Tour. And I wanted to take this opportunity. We can talk about Kubernetes and Spring and exciting things like that, that you know more about than me. But first, you told me you had a really good hamburger last night, right around the corner. Yeah, I did. Well, actually, at lunch today. I skipped the chicken masala and I ran across to a place called Cowbell, just around the corner. And I had an amazing hamburger. Yeah. So it was a hamburger and it had foie gras on it, which immediately is a win in my book. But then they had this like orange marmalade and a, quite a tart mustard, like a horse strategy mustard. And so both those two things kind of cut through the richness of the foie gras. So it made it a lot more delicious. And then they served it with these sweet potato tots that they had dusted in this like cinnamon sugar mix. So it was like somewhere between tots and donut holes. Kind of like a potato beignet. Right, exactly. Huh. And then we had a chia wine float. And so chia wine is a cherry soda, I think. Oh, I had some of that at lunch. Yeah. Not a float. Yeah, yeah, yeah. Yeah, yeah. And it may have had a little bit of cherry brandy in it as well. But, you know, it's a work day. So we didn't go too much. Right. It's a content enhancer. Exactly. That's right. All right. What's it called? Cowbell? Cowbell. Yes. Because you always need more Cowbell in your life. That's right.
2:00All right. Well, we got that covered. That's the important stuff. So you've been writing a series recently about how to do like a spring and spring boot and Kubernetes, right? Yes, I have. Yeah. And how long is the series going to go on? Until I figure it out or I get bored, whichever happens first. So that's honest. Yeah. I'm coming at it from a couple of different angles. One is I've never written a line of Java in my life. Actually, that's not true. As of earlier this month, I wrote a patch for Halyard, which is part of the Spinnaker tooling. So I now have one line of code that I wrote in Java. And hopefully sometime in the next 12 months, I'll actually accept that pull request. Oh, yeah. That's exactly right. Because, you know, that's always a thing. You contribute to open source and then you wait for someone to actually review it and merge it in. All right. So what are the concerns if you're deploying like a spring boot app to Kubernetes? Like, what are you, I got a command prompt here and I've set up some Kubernetes thing. Right. I mean, is that, or is that jumping the gun? Well, I mean, the first thing you need to do is actually get your spring app inside of a Docker container, right? Inside of a Docker image. Right. And it's not necessarily obvious on how to do that. Ordinarily, you would have a Docker file sitting in your code repo and it would say, like, from Java, run some commands and magic happens. And your application is now inside the container. What I found with Java is often people are expecting you to have already built the Java file and then inject it into the Docker image versus have it compile itself inside the Docker image. And there's some tools that actually do that, that do that for you. And so you don't even need, you don't need a Docker file. You don't need anything. You just say, hey, Maven, make me a Docker image. And there's a tool from Google called Jib, J-I-B.
4:02And there's a couple of tools from, I think, Spotify that will either help build one from a Docker file or without a Docker file. And it just, like, takes source and compiles it for you or it takes your already built one? Yeah, it takes your source. Like, you do Maven install or you add some Maven commands and it will basically build it for you. The interesting thing with the Google one is it will actually build you a Docker image without you needing Docker on your computer. Right. Which, I mean, I have Docker on my laptop, so it wasn't a big deal. But it means I can build my images in a CI system that doesn't have a reliance on Docker. I see. And so one of the CI systems I've been playing with lately is drone.io. And they're in the middle of rebuilding that on top of Kubernetes with Kubernetes being, like, the engine for running the actual CI tasks. Oh, right, right. And so ordinarily, if you want to build a Docker image inside of a Kubernetes pod, you have to either allow privileged mode, so you can run Docker in Docker, or you need to map your Docker socket from the host into a container. Both of which have some spurious security concerns. Whereas using this tool, I just don't need Docker at all. And so it will build it into a Docker image and then it will upload it to the Docker registry without needing Docker on it. Because really, a Docker image is a tarball with files in it. And so you can just untar that, throw some more stuff in it, tar it up again in the right format, and you've got an image. And so it seems like the assumption of, like, Docker and Kubernetes then is, like, you're going to give me a pre-made Docker image. Exactly. And hence all these exciting workarounds to, like, not do that. Exactly. And that may change a little bit as, you know, Knative is a newish thing in Kubernetes that has some tooling for building images. And so that might help with that a little bit. But it's probably going to use the same tooling under the hood as I'm doing manually anyway. So, you know, whether it's me or Kubernetes doing it, there's still something doing the build of your image.
6:08Right, right. Before you can run it. And then so you get the thing built there, or you get it in there, and then what? Like, how do you, like, run it? All right, so I've got my image built. I've pushed my image to a Docker registry so that my Kubernetes cluster can then get it. And then if it's, like, a Hello World app, I can do kubectl run, give it a name, and point at my image, and that's enough to get it running. Okay. But it's probably not a Hello World app in real life. It's probably got, you know, some config files that need to be modified. Like, yeah, the pet store you were using. Exactly, the pet store, some other stuff. And so with the pet store, it's still a fairly basic app, but it's got, it needs a database. And so you can use an in-memory database, or you use, like, an external MySQL. And then it has a bunch of config settings that you can expose, you know, to change, like, you know, MySQL host and stuff like that. And you can do those via environment variables, which you basically capitalize, like, spring, underscore, blah, blah, blah. And you basically simulate the application.yaml or parameters.xml, whatever that file is you use to tell Java. Like you said, you're only a recent programmer. Exactly. And so, and so you, environment variables. And that's enough to get, like, your app running. What's interesting, though, is sort of spring adopted a lot of the things that came out of Netflix for, like, service discovery, for, like, doing an external configuration server and things like that. And so, spring has these adapters to tie into those services. Well, Kubernetes provides ways to do that, those as well. And so there's a spring cloud Kubernetes project that basically will let you just automatically use the Kubernetes versions of those things.
8:08Okay. So, in your pom.xml file, if you're a Maven fan, which I'm still learning, I didn't realize that in January of 2019 I would be writing, handwriting, XML files. But, you know, here we are. If one of our Java devs in the room, Mark Heckler, would like to rewrite it so that we can use, like, a pom.yaml file, that would be amazing. If you could send that up to Maven, I'm sure they would happily take that for us. Do they still use DTDs in XML? I don't know what that is. Okay, good. Probably. Yeah. Probably. So, anyway, you put this, like, four-line thing into your pom.xml to say, I've got a dependency on spring cloud Kubernetes. And then if you deploy it to Kubernetes, they'll automatically get, like, service discovery. So, any services or pods that it should know about, it just asks Kubernetes for the host names and IP addresses. Because Kubernetes already knows those things. So, then you can be, like, is this the right granularity? Then your pet store, your store, can be sort of, like, pod aware, right? Exactly. Right, right. Yeah, so, if it needs a MySQL backing store, and I'm running MySQL in my Kubernetes cluster, I don't need to, like, give it an IP address for my... You have to figure it out. Right. I just need to say, I need you to go to my MySQL service. Okay. Okay. And then I can use a config map or a secret, which are Kubernetes constructs, which are basically key value pairs that Kubernetes keeps track of, to configure my app as well. And so, assuming the config map is named correctly in the right nomenclature, the app will read those config maps and say, okay, these are the config settings to use for the app. So, I can put my MySQL server name, my username, my database name into a config map, and I can put my password into a secret, and it will automatically load those things up when I start the app.
10:08Okay. So, I don't need to be, like, hand-rolling a YAML file to stick in the container. I don't need to be, like, putting in, like, 15, 20 different environment variable lines. Yeah, yeah, yeah. I can just stick it all in a config map and have it actually just read from it, which is super interesting. I haven't tested how it handles, like, when you modify the config map, and so that's my next. Oh, right. Because you have to, like, redo stuff. Right. Because I know with the Spring external configuration, I think you send it some sort of, like, an API call to an actuator to tell it to reread its config. Right, right. So, I don't know if I'll have to do that, or, so, that's probably not the next blog post, but the one after. Right now, I'm just, first of all, explored how to just get, like, a basic app up and running. So, by using, like, the Kubernetes imperative commands, like kubectl run and kubectl expose to get the app up and running. So, my next post will probably be about, okay, now let's actually write some Helm charts. And I'm writing a basic Spring Helm chart with the idea that most Spring apps have this very similar set of characteristics. Yeah. So, I can have one Helm chart that will deploy most Spring apps. Right. And then, from there, I'll probably then get on to config maps and service discovery and some of the other tighter integrations. So, then to recap, we've got a store, an application that's a store. You can find pets or music or whatever. And you're going to want to, like, compile that as, like, a Spring boot app, I guess. Right. Or whatever. Exactly. Now, right there, you can either compile it on your own and build your own Docker image. And then, you stick that in a registry. And then, you use your kubectl stuff to basically have that run in a pod somewhere. Yep. And then, but then there's a variation there where basically you could say, like, I want the build pipeline to build this thing for me.
12:12I don't want to have to create the image on my own. Or I'm not allowed to create the image on my own. And then, once you get that, so then that gets deployed into your pod. And then, after that, you're basically, like, now, within the Kubernetes cluster, I need this database. So, I need some way of passing through from my XML or YAML file, ask for the store database. And then, that will get injected into your Kubernetes name value store somewhere. I'm doing a lot of hand-waving. Yes. But then, if you've included this Spring for Kubernetes wingding, that knows how to go up to Kubernetes and stay. And say, tell me the database. And then, it basically jams that in for you instead of having to pass in all those environment variables on your own. Yes. It's like you actually listened to me. Your eyes were glazed over when I was talking, but it was actually being taken in. That's right. That's right. I got to work for my paycheck. Otherwise, I wouldn't be listening to you. Okay. So, then, like, does that, how do you, well, so why am I using Kubernetes in the first place? That's a great question. Usually, it's because you have some sort of organizational pressure to do so. Sometimes, it's real. Sometimes, it's political. Sometimes, you're doing it because, you know, the old way of doing things is so bad that it's worth taking on the pain of, you know, using Kubernetes. So, Kubernetes is great. I love using it. But, like, there's not a lot of point in using Kubernetes for Kubernetes' sake, right? Right. If you don't have a set of problems that Kubernetes solves by bringing it into your organization, you're just creating more problems and not solving the ones you have. So, if you find yourself with a set of problems that Kubernetes can be part of the solution to fix, then that's really when you want to be looking at Kubernetes.
14:12And so, what are these problems you might have? Oh, boy. Well, let me be more directed. So, what is a reason you would be using Kubernetes, right, that creates the next thing that you need to solve when it comes to running Spring and Kubernetes, right? So, we've gotten an instance running. Everything's dandy. I assume part of why you want Kubernetes is because of, like, elasticity. I don't know if the kids say that anymore. Yeah. But some sort of, like, scaling sort of thing. Yeah. So, Kubernetes has a lot of good properties for running, you know, web-scale apps. Right. It handles scaling applications up and down really well. It's really smart about how it deploys them. You know, they're lighter weight than VMs. There's a bunch of things it does. I just lost my chain of thought. Better edit this out in post. Oh, that's all right. So, you got your sprint, your store running. Right. And then, all of a sudden, I'm doing really well selling pets. Yeah. I don't know what that means. Yeah. Okay. So, like, let's take a step back to before you're running a pet store, like, why you're actually going to go to, like, have Kubernetes there. Because you're not going to get a Kubernetes just so you can run a pet store, right? You've got a larger endemic problem. And often, that's around, like, just the amount of toil and the amount of effort and the amount of time it takes to get an application, package it up, and deploy it. If you have a lot of pain around that, and you haven't already made a lot of inroads into solving it using, you know, there's a lot of tools and techniques out there in, like, SRE and DevOps realms around helping do infrastructures code, config management, stuff like that. If you haven't yet gotten into those, or you've sort of got to the point where you need even more efficiency, Kubernetes can help with that. Because Kubernetes as a platform is kind of almost DevOps aware. Like, a lot of the things you try and do in DevOps.
16:12It embodies a lot of the patterns and practices you would do. Such as what? Such as, like, building, like, small atomic scalable units that are easily deployed, easily updated, if you're using a Kubernetes deployment, you don't need to, like, write in any, like, deployment scripting orchestration. You change the, like, you update your image in the deployment manifest. And the Kubernetes deployment controller will actually go and perform a rolling upgrade for you. Oh, yeah. Okay. Right. And so there's a lot of things like that, that it removes the toil. And so if you don't already have good practices and automation around that stuff, you can kind of get that stuff without the, like, the heavy amount of pain you would have gone through before we had some Kubernetes. Okay. That makes sense. Hence, you're wondering, for part three, I think you said, of your thing, like, if I update my properties, how does that, like, kick into the thing of, like, doing an upgrade of everything? Exactly. Yeah. Because I want to look at, like, we can run a Spring app in Kubernetes quite easily. But what's an actual, like, production Spring app? Yeah. So I'm, like, I have to be, like, it has to respond to changes. It has to be upgradable. It has to be monitored. It has to have logging. There's this new movement around, like, observability and tracing. So I should probably have some of that. Right. So, like, what is all this stuff I should have to have what would be really considered, like, a production-grade Spring app? And then what are the things that it gives me? And then also, what are the drawbacks? Like, what are the things that, like, every platform has drawbacks. So what are the things I'm going to have to figure out how to work around? And so that's kind of the, that's where I'm trying to get to is slowly build my way up to, okay, now I fully understand how to run a Spring app in Kubernetes. You know, as a, coming from an ops background, a lot of the way, like, you kind of have to
18:13think, like, the thing you are deploying or the thing you're deploying to, to be able to really deploy it in a production way, right? Oh, yeah, yeah, yeah. And so that's kind of the, I need to really understand. You have to think like your enemy. You have to think like your enemy, right? So I have to really understand how Spring Kubernetes integration works. I have to really understand how Kubernetes works. And, yeah, so that's. And then, so maybe even the simplest thing is like, so then let's say I'm going to upgrade my pet store upgrade. I'm going to add a feature where you can, I don't know, in addition to ordering a pet, you can, it'll also suggest food serving bowls to order with you. So I have to add some new feature. Right. And then. So like a recommendation engine. Yeah, yeah, yeah. And then, so like, how do I, how do you envision that gets updated? Yeah. So that's a great question. So the version of the pet store, cause it's like eight versions of the pet store now is different versions of Java and Spring. But there's competition, right? And so the version I'm using is kind of the basic one where it's kind of a monolith. And so if you're going to add a new feature to it, you'd probably go down that like a Strangler pattern where you like add a new feature as a microservice. And have like a proxy in front that knows how to write route the, the new, the new requests to the new recommendation engine versus the monolith. Yeah. Yeah. And so you would hopefully have a much smaller app that just does that one thing, looks at previous purchases, does some, I don't know, machine learning or whatever, whatever it is they do. Yeah. But then, but then how would you like deploy it to the cluster? And so what I would do then is I would probably have a Helm chart or something like a Helm chart specific for that app. And so I would, I would deploy that. And that Helm chart would be creating a deployment and a service config map, those bits and pieces for me. And then obviously I would then need to go back to the old app and provide any integration points it needs.
20:13Like if it needs to now talk to like a rabbit server to get messages across or whatever. So get that integration working. Obviously I'd need to deploy a new version of pet store with the integration points in it. And then I would probably need an ingress controller or something over the top, which is the thing that's going to determine, okay, you're going to like slash recommendation. So I need to bring, take, bring it to the recommendation API or whatever. Yeah. Yeah. So that the right requests go to the right. And does Kubernetes help you with like that sort of release thing where like I've got a new version of this pet store thing and then I need to deploy my recommendation engine. And I don't know even how you kind of do the topology of that, if that's a word, but like, is it, is that like one of the patterns that's written into it? Yeah. Well, usually you kind of want to consider them to be separate things so that one deployment doesn't rely on the other deployment. Right. Right. And so the microservices. Exactly. Hence the microservices. That's what that stuff does. Yeah. So if I've done my microservices right, if I've done feature flagging right, I shouldn't need to like deploy both at the same time with some magical sequence to make it work. Right. I should be able to deploy my recommendation engine. I should be able to validate that it's working. And then I should be able to either flip the feature flags in the pet store or deploy the new version of the pet store that has the right bits to then have its side of the integration store. Right, right, right, right, right. And then, and then, so if someone's in the middle of like purchasing something from the pet store, right. And then you're going to add this new recommendation engine. Right. Like does Kubernetes do that so you don't lose that sale? Yeah. So Kubernetes will make sure that the new version of your app is running before it closes down the old version. So. Right. And then we'll like let someone finish their transaction of buying something or.
22:13That then gets into like how your app and Kubernetes, like how closely they are, how close they are friend wise, right. Yeah. Like if there's a, like Kubernetes should ask your application to shut down gracefully. And your application should be smart enough to say, hold on, I just got to finish this thing's purpose. About to sell 10 pythons. Right, right. Finish selling 10 pythons and then close itself down. Right. And so assuming that your app will happily gracefully shut down. And that's kind of still part of microservices, right? That's part of the 12 factor. I think so. There's a whole section on graceful shutdowns and all that sort of stuff. Um, so assuming that's happening. And then also assuming if you're doing some sort of session state, if you're saving that into, uh, our friends, Redis labs or something like that, so that you're not relying on state on a particular pods, like a hard drive or whatever. Yeah. Yeah. Um, then obviously, and in theory, any of the other pods that should be able to just take a session because the session is all sitting in some sort of cache or, you know, Redis or whatever. Right, right, right. So, so it seems, it seems like a, a, a best sort of easy scenario is following all the like stateless 12 factor stuff. All these processes you're killing never actually hold on to anything. And instead they refer back to the, you know, the magical data source that handles itself. Uh, and, and therefore like when you bring down the process that's buying the pythons, it just comes down and when the new one comes up, it's like, Oh, here's a Python buying thing. And it just resumes doing that. Yeah. And then sometimes it's worth saying, well, you know what, that person will probably reattempt to buy the 10 pythons if it fails. Yeah. You know, I mean, if you wanted 10 pythons, you're probably going to keep doing it. Right. Exactly. Although I don't know how many times have you just been about to buy something and something happens and then you have to wait five minutes, you know, like that was a bad idea. That is true. That is, that's, there is, there is certain, uh, you know, you kind of get the buyer's remorse flashback before you actually make the buy. Huh. Yeah. Uh, so, so then, uh, why don't you explain before we close out, what's the proper way to
24:17cook a hamburger at home? Like, how do you do it? Like, all I know, all I know is you press your thumb in the top of it. But how do I get, how do you get a restaurant-grade hamburger? So there's two thoughts on making a hamburger. You've got your pub-style hamburger, which is a big, thick meat patty, right? Yeah, yeah. Uh, and then you've got your fast food hamburger, which is like your smash burger. Yeah. Where you're cooking on like a flat surface and you just like smash the hell out of it. Uh, and I actually prefer the latter, the smash burger style, because you're getting a lot more surface area attached to that grill. You've got like pockmarks and stuff. And so there's going to be a lot more browning and it's going to be a crispy burger. A crispy burger, delicious. Like Freddy's. And if you want, exactly like Freddy's. Yeah, yeah. And so if you want a thick burger, then just have, have four smash burgers between the two pieces of bun, right? Um, but the thing, the thing that I learned, um, when I, when, when I actually moved to the U S is that everywhere outside of the U S makes their burgers wrong. And that is you put a bunch of fillers and other crap in there. So, you know, you get your ground meat, you'll add like an egg, you'll add breadcrumbs. Wait, we do that in the U S or? No, outside of the U S. This is outside of the U S. Okay. Okay. And you basically end up with something that's more of a, like a meatloaf than it is a burger. Right. Right. Whereas in the U S you just have your ground meat, you kind of form it into shape and then you season it right before you cook it. Okay. Right. Um, cause even, even mixing salt through, uh, messes with the proteins and kind of, kind of binds the meat together and gives you that more meatloaf texture. Okay. And so either pub style or smash burger style, you, you grind your meat, you know, there's you want, I think it's 20% fat in your meat. So there's certain cuts that kind of give you that. Um, if you can grind it at home. That's great. Food processor works well for grinding. And if you've got a food processor, uh, and then if you're grinding yourself, you're, you can like, you can cook it like to medium rare and stuff a lot safer than if it's sitting
26:19at the grocery store. This is the part I always screw up is the cooking part. Right. Now there's the tip about only season before you're cooking. That's good. Right. And don't put a bunch of eggs and biscuits in there. But like, but like, so the cooking, so like, what am I in a medium heat? What am I doing here? So I would say start with making smash burgers, right? Cause you just get your cast iron pan or some sort of flat surface up as hot as you can get. Uh, you put like the burger patty on there and then you use like a press or a heavy spatula and you just press it down as hard as you can. Yeah. Uh, and what is that? Like two minutes each side or something? Yeah, exactly. Like two minutes each side. It's like fish. And it doesn't matter if it's like well done because it's so thin and you just bite through it anyway. Right. But then, but then if I've got one of these stick burgers, how am I going to manage that? Uh, so, uh, kind of the same way your, your, your thumb trick totally works. Um, you know, as it cooks, it will actually kind of shrink in and swell up. So it'll become like, right. It's almost like, yeah, it's become taller. Uh, and so pressing your thumb in can kind of help because it's got to fill in that shape before it grows taller. I see. Um, but really just, I, I like to start on a high heat, uh, get that first side really going and then turn the heat down when I, when I flip it. Okay. Um, but you know, it's hard to go wrong. I always like to use a flat surface rather than a like grill because you want as much of that meat round as possible. You like a crispy burger. You want a crispy. Yeah. And so the browning is the flavor. Yeah. Well, that's very helpful. So, so deploy your pet shop and then, uh, get your configuration flat surface for a burger. Light surface for a burger. Okay. That's good. All right. Well, thanks. Thank you for being where you had a Twitter handle or something. I do have a Twitter handle handle. It is at Pete Tchaikovsky, which is, uh, I don't know. You can put it in the, in the show notes. It's hard to, hard to spell. I don't know why I've got a stupid hard to spell name, but I do. So I blame my parents. Exactly. All right. Well, uh, thanks for listening. Bye bye. Bye bye.