How To - Deploy a containerized a MidServer in Kubernetes
hi this is mike gallagher i am an advisory solution consultant with the it transformation team here at servicenow and uh hopefully this is a screen that i'm showing that you're familiar with um and today we're going to be talking about deploying a mid server in a containerized fashion in a kubernetes deployment and i'm also posting a blog post about this that we'll dive into some of the how and why and get really into the details but i wanted to record this video to just show the process and how this is going to work so that way if folks want to use this video alongside the blog post we can help people get containerized mid servers deployed in their kubernetes environment okay to that end i am going to start building out this deployment and the first thing i always like to do is to build a namespace in order to sort cordon off the infrastructure based resources that i use with environment in my environment unsurprisingly that namespace is called infra so what i'm going to do is i'm just going to quickly show you this namespace yaml file that i've built pretty straightforward tells you what kind of resource we're deploying what api version and then the metadata around it so i'm going to actually apply that file to my kubernetes cluster and in this particular case i've already actually deployed the namespace in the past so that was unchanged that's one of the wonderful things about the kubernetes control app is it checks to see if anything has been changed before it actually attempts to make changes so once that's done we will just confirm that we have all the name spaces and correct i have an infra namespace here that's been active for roughly about 10 minutes excellent so the next thing that we need to do is we need to in order to securely provide the mid server with the password to log into our servicenow instance we need to create a special resource called a kubernetes secret and this will store the password in an encrypted secret file within the kubernetes cluster that we can provide to the kubernetes excuse me to the mid server container so that it can use the password to log in so in order to do that we're going to use this command here so cube control create secret generic is the type of secret dash n is inside of the infra namespace and then we give it the name of mid dash server dash secret and then from a literal and secrets are are built in a key value pair right so the key for this is sn underscore password and the value is this password here so we're going to go ahead and create that oh and it complained that it already exists because i've run through this test before so now we're just going to quickly describe that ah it's not found because i didn't specify that i want it in the infra namespace right which is one of the great reasons why you want to put things in the right namespace so that you can keep segmentation of your resources so we have the key of sn underscore password and the value is 20 bytes but it's encrypted and isn't going to show here okay so now that we've got that namespace created and we've got the secret created and ready for ingestion by the mid server we're going to look at the mid server deployment so this is a little bit more complex and we'll kind of talk through a bit of it but it's this is a deployment okay and here's some metadata around it but the name of it is which namespace it's going to go into and a label right a key value pair to be able to use as metadata to look for it later so here's the spec i want one replica of it we're going to match these labels and then here's the container itself and here's a big point right here we are using a community created docker image for the mid server this is not an officially built or supported container image for a mid server by servicenow itself this is a community created thing so you know definitely caveat mtor use at your own risk but i wanted to be able to show this process and my hope is that in the very near future we'll be able to provide an officially created and supported docker image for mid server so the environment that gets passed into that container is going to have all of these important variables so hostname is the servicenow instance the fully qualified domain name the servicenow instance for this mid server to connect to this is the username by which it connects into that instance and then the password variable it's going to get from that secret that we built already and then the host name is how it's going to reference itself as far as the servicenow instance is concerned so you'll see once we get this up and deployed and we go back into my test instance that we will have a new mid server named itx kate's mid eks underscore secret dot docker i believe is what it's called so now that we've got that built and i've shown you that i'm going to go ahead and apply this yaml file so that it will create that deployment and when we do this it's actually going to pull down that container image from docker hub and start to deploy it within our infrastructure within the infra name space so in order to show this running and get some details on what's going on i'm going to go ahead and say get pods dash in infra okay look at that it's running and if we want to get more detail we can describe the pod in the infra name space okay so it's been assigned to run on a specific host here's the various container image it's already there and it's created and it started so it all seems to be up and running and working correctly so let's go back over to my servicenow instance and we'll go ahead and reload this list and you will see now that we have itx case mid eks secret mid.docker and it the image that is out on docker hub is actually a paris image so it's pulled that down it's deploying it and exactly as it would with any other mid server it's going through and it's going to go through and do the upgrade process since this is a quebec instance it'll upgrade it up to quebec and then i'll need to go in and validate that mid server so that it can be utilized once it's ready to go so now you've seen start to finish how we deploy a containerized mid server as a deployment within a kubernetes infrastructure i really hope you find this useful and i look forward to seeing more mid servers running in containerized instances in the near future thanks and have a great day
https://www.youtube.com/watch?v=59NY8qbdcjc