 Okay, in this video, we are going to set up readiness and liveness probes for Kubernetes. So basically when a pod is up, Kubernetes has the ability to be configured to see if the service is ready. So there's a certain amount of time that you need for startup to initialize the service. Arguably Java can be a little bit longer in some cases. Also we have liveness to make sure that the service has not hung up. And in Spring Boot 2.3, they added endpoints to Spring Boot Actuator to support this. So to enable it, first of all, if we need to be on Spring Boot 2.3 or higher, in the services that we're using right now, they are on Spring 2.4, if I remember correctly. So we are definitely ahead of 2.3. That's been out for over a year at this point. Here we just need to enable it. So you can see on line 35, I'm setting a system property management endpoint health probes enabled. So this is setting those up to be enabled. And then specifically we are doing the readiness state enabled and the liveness state enabled. So this takes care of the Spring Boot configuration. Now what we need to do is actually set up Kubernetes to actually look at those. To do that, what we want to do is I'm going to come in here. And this is in the container definition. So make sure that we are, yeah, it can be a little tricky. So that's why I like using IntelliJ here. I can see exactly where I'm at. So I'm still in the image definition. And here what I can do is define the readiness probe. And that's kind of a weird looking word to me. So we do readiness probe. And here we are going to do HTTP get colon. And this is going to be running, this is the inventory service. So this is going to be on port. I double check this 8082. And we want to say path. It's going to be actuator. So it's be actuator health readiness. So that takes care of the readiness probe. So just to reiterate, there's two components to this. So one is the readiness state enabled. That sets up Spring Boot to be enabled. And then this clause here in the YAML readiness probe, the HTTP get, that is telling Kubernetes do an HTTP get to port 8082 to the path of actuator health readiness. And then we also need to set up the liveness. So liveness. And again, this is going to be an HTTP get. And as you can guess, this is probably going to go actuator health. And that's going to be live. And again, that's going to be port 8082. So that configures that piece there. And what we want to do is we want to apply these to all the services to save you from watching me do a bunch of typing. I'm going to pause. And I'm going to edit the other files and then come back and do a code review. So what I've done is I've gone in and modified the other deployments, both for the inventory service and the order service to enable those. We could optionally do a failover. I'm not going to bother setting up failover. It's pretty simplistic. If you want to, you can go ahead and do that. But more interested in having these run properly, the three core microservices. The failover service is like a really, really simple Spring Boot microservice. So now the last thing that we need to do is actually reapply these. So what we can do is come back over to the command line. Let's do clear inventory deployment, peer service deployment. And then we also need to do the order service deployment. And here, you can see here, if we keep refreshing this, we can see here we have an order service creating. So because I did the apply action, what's happening is that Kubernetes is shutting down the old pod, the old container, and bringing up a new one with a new configuration. And if I come in and do a get all again, we can see that now we are running. Actually, we're still going through re-initializing them. So that's going to take a couple seconds to settle down. But once the services do re-initialize and start back up, Kubernetes will be happy and everything will be working again. So let's come back over to IntelliJ, just as a quick recap of what we changed. Let's do the inventory. So we added in three new environment properties to enable the readiness and liveliness end points in a Spring Boot actuator context. And then also, we set up the readiness and liveliness probes to go ahead and do those. And I just realized I made one mistake here. So beer service, that is on 8080, the beer service deployment. That should be 8080. And that could be why that was restarting as well. And order service is running on 8081. We want that running on 8081, like so. And let's come back over to the command line. And we want to do the order as well. Remember, whenever we make a change to the deployment, we do need to reapply that. And then we'll tell Kubernetes go ahead and redeploy that. So again, take a minute for that to come up. But that is how we set up the readiness and liveliness probes inside of Kubernetes using Spring Boot actuator.