Zero to Deploy: Launching a Node.js App on Kubernetes (English)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] so I've never done this before so let's see if it actually works ready 3 2 1 okay so first thing empty a minute all right go if you met this now we've in that file package all JSON all right now we need a little NPM start why am i doing in vim I don't know it seemed more challenging all right all right done ah any mistakes please yell at me all right this I'm not using that I'm going to use this code because it's better ah let's see so I need to magnify much better okay test in lightning I have my attach a s what I'm going to do is copy paste some code yeah copy paste look at this it's not even a Tyrell function no all right arrow function it that makes it cool all right huh tell a view all right sweet saved I don't care all right we're going to listen on port 3000 because I like that better okay let's NPM start see what happen okay that's wrong come on use port at least localhost 3000 okay awesome working locally very very difficult all right now comes the fun part so docker so doctor file again not using that I had all these plans so what I'm going to do is use the node Alpine which is the small small really dr. hook oh okay I'm was going to assume that it dr. hub didn't crash bleep them crash dr. hub ah so all I'm going to say from node Oh fine okay so now I'm going to and then it's going to basically copy do npm install this methyl packages so nothing copy everything over and then run NPM start when I run the docker container who has done docker before okay who's done kubernetes before okay good good good ah I have Google I work here so really the Google Wi-Fi went down anymore all right campus speakers this is part of the live demo right okay s pe100 ten minutes come on Wi-Fi the Wi-Fi is required for class oh yeah all right so instead of building locally and pushing a giant image up I'm going to use a container builder it's basically like a thing that builds containers it's free for most things all right no okay so it's gonna text my code push it up and build the docker container if the Wi-Fi works perfect okay while all that's going on let's build our cluster I'm going to use container engine which is our offering you can also use like a juror you can use whatever that has kubernetes let's just create cluster one good names so equals us why not one F I like that zone so it's going to create a three node kubernetes cluster for me sure probably is Europe but you know what that's okay all right so let's go back here and this okay it built my allows weight faster net dot yeah alpine okay so we have our container built and pushed into the cloud now we actually have to do our deployment llamo again not doing that deployment again also this is where I'm going to copy this copy but I'm going to go through it so what is a kind deployment deployments basically deploy pods which have containers in them it's called our node app replicas how many copies we want but seven and then the label so the name note app you can put whatever labels you want like area 51 yeah Plus sounds cool and now here are containers so the name is no nap we can put again whatever name so our image do see are that IO is Google's container registry way you can use docker hub wherever you want to store your containers so in this build command that we ran before I pushed it here so let's copy that put it in and I called it 0.1 or 1.0 okay now it's using container ports 3000 don't need this don't need any environment variables because those are too complicated for 10 minutes okay so if we go back and look at our docker file we didn't expose the port 3000 that was a mistake so let's do that 3000 suite rebuild all right so now let's look at our deployment mo suite we have this done let's look at our kubernetes cluster still creating I should have done that in the beginning so you have some mistake - all right so now we do our service so gamal again not using vim okay so in service like animal is where we load balanced traffic to our containers running in our cluster where is it oh no oh here it is yeah so again name let's call it node app and so it's going to take all traffic from port 80 and for it to port 3000 using the TCP protocol yeah so now the shouldn't thing here is the selector so the selector is going to see what containers to forward traffic to so it's going to say anything with name node app I can also say area 51 because that's also a tag that we put on our container but I like this better and then finally type load balancer so on a juror AWS Google Cloud this will actually launch a cloud load balancer for you automatically so you don't have to do any configuration which is sweet still creating a cluster oh man those a mistake should have done that in the beginning ok cool thing is we have our container pushed up again so let's take a look at that how much time do I have six minutes okay let's go and look at our container alright this one patch is ready is it pretty it's ready awesome so that's pretty fast let's close this you don't need new eyes who needs that alright so now let's actually deploy our stuff so also deploy a service so use the coop CTL tool let's do a get service so that's what's currently running on that cluster absolutely one thing because we have a crew berating service so now let's actually build cube CTL create dash F service gamal so this will create that service by reading from a file so we get service ok so we have our node app service and as an internal IP external IP is pending which is exactly what we expect spinning up a load balancer all right and now let's actually deploy the deployment [Music] all right who can find the error let's play that game let's take away air at 51 I don't like that because it looking for a string but it's not a string building number yeah Moe all you do this to me all right so let's go keep CTL get deployment boom okay we have seven already running because Alpine is small use small docker containers guys see how fast it is okay get pods boom seven of them running in our cluster yeah alright and the final step I say that now let's see copy ready ready and come on let's go connecting yeah alright how much time do I have I have time to update it I have time to update it alright we're going to do it live let's do it okay I thought Jaz hello Tel Aviv it was awesome in this city and no this is turtle you know what I can't I can't I can't I just can't it is just too bad I'll let four equals three thousand but no semicolon screw that alright okay so what we're going to do really fast is we're going to build that new thing and we're going to call it version 2.5 s Eve the file good okay so while that's building let's edit our deployment so I'm going to say cube CTL edit deployment oh man what was it called no tap ok so this will actually bring up the yamo in bim or whatever you want you to edit i should probably switch it to be as code okay and what I'm going to do is a hack I'm just going to change it to 2.0 here usually advise enough to different demo but you don't has time for that okay I'm really bad at them too okay done edited so now if we look at our deployment okay it's rolling them up let's look at the pods it's updating updating terminating the old ones creating the new ones it's probably good to go it's good to go alright and hump a bum buh buh buh buh buh buh buh buh buh buh buh buh bum bum bum bum
Info
Channel: JavaScript Israel
Views: 32,412
Rating: undefined out of 5
Keywords: JavaScript Israel, jsisrael, jsil, JavaScript, NodeJS
Id: DwlIn9zOcfc
Channel Id: undefined
Length: 10min 35sec (635 seconds)
Published: Wed Aug 09 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.