Docker, Rancher, Kubernetes... Minecraft? (Rancher Setup and Install Tutorial)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so you want to run docker in kubernetes at home but you're not really sure how to get started you know that docker and kubernetes are things that large enterprises are using but you're not sure how to set it up at home well today I'm going to show you how you can set up docker and kubernetes and containerize things like a minecraft server [Music] hey welcome back so I'm techno Tim and today we're gonna show you how to set up docker in kubernetes using something called Rancher so let's start from the beginning what is docker so doctor is a way to containerize an application it's a way to package software up put it in a container and ship it anywhere you want you can run it on your local machine you could run it on a server or you could run it into the cloud it can be spun up really fast nothing gets installed and they can be torn down really easy too so you might be thinking well isn't that what a virtual machine does not really so in a virtual machine you're virtualizing a whole entire operating system so each time you spin one up you take on all the resource requirements of a whole entire operating system and let's say you just want to run a minecraft server well now you're taking on all of the requirements of the operating system just to spin up a minecraft server but what if you can isolate just the minecraft server process and bundle that up and ship that anywhere well that's exactly what doctor does and so we can use a virtual machine to put containers inside of instead of duplicating this virtual machine over and over and over we can have one virtual machine with hundreds of containers so in comes kubernetes now kubernetes helps you orchestrate those containers it helps you put containers on the machine helps them take them off it can run health check in system checks to see if they're alive it can help automate rollouts and rollbacks if something goes wrong it can also help orchestrate storage or load balancing and the list really goes on and on and on so I'm not gonna go too much into detail us why you'd want kubernetes there are plenty of reasons why you'd want it but traditionally it's been really hard to set up so in comes Rancher now Rancher helps you deploy in Orchestra kubernetes I've been using Rancher for years and I just love how easy it's made container orchestration and in their latest version they now support kubernetes so I thought this would be a great time to document how to spin up kubernetes at home using Rancher it's a lot easier than you think so let's get started first you're gonna need a server to install this on I'm using Ubuntu server but you can use any Linux version you want most the commands we run will work with any version of Linux but I'm gonna focus on a Bluetooth I'm also virtualizing a boot - you don't have to you can run it bare metal but if you want to virtualize it i've got a guide on how to install and configure ubuntu on top of proxmox but all of that aside let's just start with in Bude - installation so first we're gonna SSH into the aboon - server that's SSH no 10 the IP address well enter our password so before we install docker we want to be sure that we're installing a supported version Rancher currently supports docker 18:09 so let's run their script so we'll copy and paste this here screwed password so we have docker installed now let's run another command so that we don't have to enter sudo every time we run docker so I think we can copy and paste this and it tells us we need to log out before we can do this so let's log out and log back in so let's see if we can run a docker command let's just run docker version and you can see Dockers running we see the output and we didn't have to type sudo so before we go any further we have a few ways to install Rancher rachel recommends installing this in a high availability configuration which I agree with however I'm at home and I don't really have the resources for a high availability configuration so I'm just gonna use the docker install this gives me everything I need to run Rancher kubernetes and docker containers on my server keep in mind that you wouldn't do this in a production environment but this is perfect for a home use or home lab use so here's the command it recommends running for docker we're gonna make a few adjustments so that we can persist our config onto that virtual machine so we're gonna persist our data using at CD so this will persist our rancher config to our virtual machines local disk so that if we destroy this docker container we can keep our config so let's copy and paste this command hit enter so now it's pulling down this docker image it's the rancher docker image it's pulling it down and now we just spun it up so if we run docker PS we see that this container is now running so let's now go to the port we expose it on which is 4 4 3 which is SSL we'll get a warning about a self-signed certificate this is okay because we just generated this and this is for home use if you get here and see that the network request has failed this means that Rancher is still spinning up so we'll just give it a few minutes next we'll need to set a password for our admin account for signing in so password will continue next it's asking for our URL this is most likely gonna be the one I recommend and now we have Rancher run so the first most critical thing we're gonna do is enable dark mode because this is like burning my eyeballs there we go dark mode so now that we have branch running we don't have any clusters running and we don't really have kubernetes running either so let's create a cluster so we're gonna add cluster we'll create from existing nodes a custom one let's name our cluster then we'll hit next then we need to give it some node options choose at CD control plane and worker let's copy this to the clipboard click done so now it's waiting for us to spin up our kubernetes cluster so keep in mind in production you'll need three nodes but again this is for home and home LabVIEW so we'll only use one so we'll go back in our terminal and we'll paste that command we just copied then why enter and I receive your password so we're now it's pulling down the rancher agent to run on this machine - and if we go back to our server we should start to see some things happening on our cluster this may take a little bit but let's give it some time if you want to check up on it you can go back in your server and run top this isn't gonna tell you exactly what's going on but you'll get a good idea of some of the processes that are running so we'll just monitor this and wait until it kind of settles down awesome so congratulations we now have kubernetes running on our machine so let's open up this cluster you can see we get a nice dashboard of this cluster how much CPU is being used how much memory is being used and how many pods are being used we can go into nodes and see our single node we can check out storage we can check out our projects or namespaces we can see that this is the default project or a default namespace this is the one we're going to install all of our workloads to so remember in the beginning when I said we can add docker workloads like a minecraft server to our kubernetes cluster well let's add one so we'll go to default make sure that the default cluster is picked we're gonna click deploy and this is how we deploy docker containers so let's look up the Minecraft docker container so if we go out to docker hub there are lots of great docker containers out there that we can use here's the minecraft one I've been using this for a long time and it works great so let's download and install and configure this so if you go into the documentation you can see the docker command right here it's docker run - D - P and some ports naming it and then the image name but we're not gonna do all of that because we're running kubernetes and Rancher is gonna help us configure that but what we are gonna do is look at their example docker compose yellow file and see what options they suggest but then we're just gonna kind of translate that to what it means in the UI it's pretty simple it goes like this so first we're gonna need this container it's gonna be called Minecraft server next we're gonna choose our docker image well that's right here then we're gonna keep the namespace default that's where we're installing all of our containers now we're gonna have to map some ports from the outside to the inside so we're gonna name this port minecraft and we're gonna publish the port of 25 565 and the way we're gonna do this is we're actually going to expose this on the host port and we're gonna use the same port so that means our server it's gonna expose 25 565 to the container which on the inside is listening on 25 565 now if that's confusing don't worry about it just put the same port and just keep in mind that you can't use the same ports on the outside but you can use the same ports on the inside either way just use these values and you should be good now we're gonna need to add some environment variables to everything you see in here under environment are the variables so this one's really important eula true assume I am say EULA and the value is true and one more thing we're gonna have to do we're gonna have to map some volume so we're gonna have to map the volume from inside of the docker container to our server or our node so way we do that is go to volumes add volumes and we're gonna bind mount a directory from the node and here at PC under volumes so on the inside it's gonna be MC and on their node it's gonna be slash data then if everything looks good it's click Launch so we'll see right now that it looks like there's an error deployment does not have a minimum availability this is just kubernetes telling us that there aren't any pods available right now but that's because it's spinning it up so let's expand this and kind of wait you can drill into it too and see the actual container and then once the health check runs it's active and good so let's actually go into this pod and let's look at the logs and we can see our minecraft server spinning up right now this is pretty awesome we have a dr. container that's a minecraft server that's spinning up so it looks like it's ready and spun up so let's connect to it with minecraft so I have the Java edition installed so I'm gonna launch it click Play and I'm gonna leave this window open on the right side so that we can see when we actually connect ok so let's click multiplayer and then proceed so let's add our server now let's click Add server and the IP address is going to be the IP address of your Ubuntu machine which is running rancher which is running kubernetes which is running this dr container i know it's confusing but just enter the IP address of that server so 192.168 doesn't 0.221 say done and you can see it discovered it and now let's let's connect to it so let's connect to the server connecting to the server let's watch the logs in rancher to see what that container saying you can see down here hey that was fast so you can see down here on the right hand side it says techno Tim connected and logged in in techno Tim join the game so I'm actually inside of my minecraft server right now that's running inside of a docker container and just to show you how fast you can spin up and spin down docker containers I'm actually gonna scale this down to zero so if we scale it down to zero there are no more containers connections lost and let's scale it up to 1 [Music] and so kubernetes is gonna take over and spin this container back up and like that it's active again we look at the logs starting back up so if we ever wanted to upgrade our minecraft server it's really simple so we would go into here and we would click at it and then we'll have to make one change to our configuration it's a scaling slash upgrade policy we're actually gonna need to change our scaling policy I'm gonna change it to kill all pods then start new the reason why I'm doing this is because we can't spin up two pods occupying the same port so you might run into issues if you don't change this for me kill all pods then start new is the best option then if you click Save it's gonna spin up a new pod replace the old one and we should have the lights version if we go back in check out the logs again [Music] we should see it spinning back up and so if you want to add more services all you have to do is that same thing go out to docker hub look for some docker containers and add them to your Rancher server and that will spin them up on kubernetes and then you don't need to create virtual machines for every service you want to run all that video is coming soon on lots of docker containers that you can use at home to do many many different things and so I hope this video shows you how easy it is to get started with rancher kubernetes and docker we were able to spin up some enterprise like features at home albeit without enterprise availability but good enough for home I'd love to see what docker containers you're using at home if you are using some leave them in the comments below and I hope you found this video helpful if you did please give it a thumbs up and consider subscribing so thanks so much for watching and as always stream on my friends you [Music] [Music]
Info
Channel: Techno Tim
Views: 185,607
Rating: undefined out of 5
Keywords: install rancher 2, install docker ubuntu, minecraft server docker, minecraft kubernetes, rancher install kubernetes cluster, minecraft server, minecraft server install, rancher server install, rancher server, rancher docker tutorial, rancher docker install, rancher minecraft, kubernetes at home, docker at home, rancher at home, homelab, kubernetes homelab, homelab minecraft, homelab docker, homelab rancher, kubernetes tutorial, k8s, k3s, minikube, what is rancher, why rancher
Id: oILc0ywDVTk
Channel Id: undefined
Length: 15min 11sec (911 seconds)
Published: Thu Apr 09 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.