Scale By The Bay 2021 : Rob Richardson, Making Kubernetes How We Build Things
Recording: Scale By The Bay 2021 : Rob Richardson, Making Kubernetes How We Build Things
[Music] thanks for the introduction i'm really excited to join you here in san francisco um thanks for joining us we're going to talk about and typically when we do so we talk about things that are there we're going to focus on tools that you can use in your local containers here's the part where i tell you i am definitely above the there are no slides this is it now the tool in this github gist and so if you head out to github kubernetes how we build things and you can get to a real setup to robrich.org we'll click on presentations here's making the link to the gist so all of that content that we're gonna do is live demos it is really fun robert.org let's head out to about me thanks for the introduction sound deeply we talked about being a developer advocate for cyril microsoft and a friend of redgate the camp is really fun easy gift camp brings volunteer developers software we start building software friday after work sunday after charities sleep is optional caffeine provided if you're in phoenix camp or if you'd like to give camp here in san francisco or wherever your computer and let's get a gift camp in your neighborhood too some of the other and uh kubernetes training and consulting part of me and one of the things on the rocks podcast episode they read my comments on there and they said there's my claim to fame my coveted.net roxbug so we're going to start easy we're going to walk through uh waverly to visualize container contents to start both in docker and kubernetes mode and too deep now let's start a little bit easy i have vs code and i have this docker file now this is for this node server and um i want to start this quickly so i come to the command line build and apparently i need a dot not for that but it doesn't go here it goes here and node v 0.1 to try and keep in my head next up i need to run it docker just specify the hello node v0.1 again do i need but i need to map the ports um except for that actually go dash p 000 to 3 000 brain energy trying to remember how to build and run a container let's use docker compose now the cool part about docker compose is bold and run details so that you can just say docker here's the hello node v0.1 here's the ports oh that i needed to set so let's do that now the cool thing about docker compose is that the image doesn't exist yet it will automatically build the container so now my website is running on port three there to localhost 3000 see my web server running inside that container i bet oh i know why localhost there we go now just as easily see and it will spin down now this is my machine's doing quite a bit right now but while it's coming up it just stopped docker composed down now you may be familiar with docker compose in which case network mode of bridge now by default create a new virtual network well what if i have one docker composed back in dpi another docker compose file for my data trying to debug a front end application i want to start both of those well by default if i start a docker network those two won't be able to communicate with each other won't create that virtual network now i can start my data stores and those community those containers can communicate together and that's perfect so that was a good get our motive bridge inside of a docker compose file let's see now i definitely can come into a top and i can come into kubernetes mode and i can enable kubernetes differently now docker desktop is great the greatest and great and nested virtualization scenarios and so let me make cubist free and open source and mini cube allows me to use sermons and kubernetes clusters inside of other i have a mini cube cluster running inside of a now i also have other virtual machines set up so i have one link or d so that i can test each one and they won't conflict if i say mini cube shell power shell it's going to spit out how to connect to this environment once i've got these environment variables set then i can run a word just here on my local machine so we can now in docker composed the fault in minicube it's the batteries included internally all of these containers included by default so let's do the dash v k8 s because i just happen to know that it asks that's pretty cool so now i can see and in this case there aren't any now mini cube internals exposed version it doesn't have some of the niceties that we automatically proxying localhost for both volume connecting to localhost colon whatever report that was i mean whatever that report was similarly sorry to interrupt uh but your audio's gone worse uh is it possible to close some applications maybe uh clear that up microphones so any applications that you're currently not using maybe they are causing something you're connecting yeah the sound seems to be quite degrading right now it's let's give it our best shot and start again there we go is that better uh not but okay we have to continue the presentation so let's give it a shot okay mini cube is the batteries included internals exposed proceed automatically i also don't get volumes proxied automatically the amount where i'm mapping this particular folder in so now in my docker compose file i'm going to reference now another way to do this let's uh what i'm training with docker asked me about hey and all i can really say is there'll be a cell v and i'll say it's in there mini cube ssh now you can't do this with the two mini cube and let's take a look around see var now where they're in here and you can actually go to notice how i did a pseudo suit to be able to get into virtual machine you can install content you can mini cube with the batteries included internals exposed for that content that is amazing so now i do need to set those environment variables in euler i'll set those environment variables here inside um vs code by going to my settings and i'll just so that now uh vs code can get to the containers as well so we got to see how we could launch uh we got to see alternate runtimes next let's take a look quick rebuilds now i would love to be able to do i'd love to be able to say docker watch now don't do that but let's do scaffold frosting because it does have that similar type of watch start out saying scaffold in it and it will write out this yaml file that would like to automatically rebuild that's cool our scaffold file and uh right here camel and it's going to reference our image here's that image and then it will run this kubernetes um on that kubernetes yaml file we could optionally push this image into it automatically rebuilding so let's pull this and then let's modify this server now right now it says hello big mountain data and dev i don't want to do that scale by the bay automatically scaffold notices that change automatically or my image optionally pushes that to a registry and ready so if i rush i can see this and here's my pod running right here refreshes let's go to mini cube colon we've already got the new version in place excellent if i come back in here to um at the no not there there and it will automatically rebuild place that is excellent soccer watch like experience that's really fun let's next oh there's the new version of scaffold very nice visualizing our cluster our visualizing it contains world v0.1 that's the image that look at dive so here's dive and visualize the contents of our container now so we can say darker history food 0.1 but man that was run and decides it doesn't tell files that's where dive can really help us here's dive hello world be 0.1 did i spell it right and that's interesting let's try it here nude oh hello uh docker image list i'm confident i'm sit there we go hello node hello node and let's cruise around through this image here we go through the layers in this image so i'm going to close a few vines let's close these folders and let us wonder the layers in our docker file so we started out by an image then we've got some more stuff here's where we got into place and then here's where our docker file started worker that's excellent next let's come here and we'll see that well we probably copied too much docker composing our docker file hmm i need to adjust my dot doc or ignore it looks like we have an ignore so now i'll ignore things like new and um my doctor compose doctor file and so now i've got all of raffle was still running it would automatically rebuild my thing and i can push so dive is able to help us wander through our contain optimize that into place to save sometimes i'll also use dive to be able to look and see if it caught if my container won't start so we got to visualize clusters in a similar way that we things from the command line lazy docker let's now lacie docker is really interesting another open source project is the docker side of a cluster so if we're using top or docker compose we'll be able to see this content isn't that cool you're using windows terminal like click on the screen if you're using uh an old um but let's flip over and let's take a look inside of our cluster here the rest of the containers associated with um kubernetes here and take a look at some of the containers i love that they can create these stats not the storage provisioner let's go to there's ah cubecontroller it's fun to be able to are created but not running okay let's pick one that is rob nope that's gonna be a fail um but it's really cool to be able to is and um our volumes we get oh it looks like this right panel isn't um we can run this a little bit differently uh lazy there we go storage provisioner and we can take a look at the stats associated to see graphs inside of a console i'm going to click cruise through this config file you notice how when you run a dock roll back up wouldn't it be cool if you could just scroll up and cool so in the same way we were able to visualize this this using ui tool as well so let's say docker compo look at it's a really excellent tool to be able to visualize the docker side of our club or with docker desktop or anywhere where we have a dr damon or the uh docker compose file for um started that up in a really elegant way so now localhost 9000 oh is it not running in the wrong directory let's get into the right directory i will have our pertainer running there we go the partainer running let's take a look at our we've never logged in before so it's been going to invite us to set a password as part of this demo is setting the password a remote cluster running on azure or another cloud cluster our on-prem cluster we could connect to another environment now it tells us that we need to map the docker socket to read into the docker configuration and so here in our docker socket mapped into place so if you can close out that would be nice thank you uh cool so this was me up on twitter at rob underscore rich or uh grab um robert presentations yep excellent uh i posted a link uh on to your presentation uh and uh we are at the moment ready to head out to special chat so rob can you please head out to special chat and people can ask you questions uh i don't see any questions i'll be there in a minute okay thank you very much [Music] you