Deploying a 4-Node OpenShift Cluster on GCE

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
today I'm going to do a demonstration on how to install open shift on Google compute engine there's gonna be a multi node setup so a little bit more complicated than the demo that I did before where I used OC cluster up to just automatically set up a cluster on my local machine for developers that's great but if you want to try out something in a produc in a more like a production environment then you may want to have multiple nodes and so there is a tool out there called the open shift ansible installer that will help you do this and this is going to be a demonstration how that works so here we've got the this is the open shift ansible installer here we're gonna start out by cloning that I'm just gonna grab this here alright and the first thing we're gonna do is go in here to the ansible config copy instable config example to danceable config we're gonna go into the ansible config file and look at what we have so there's a number of things here GCE can even do two dynamic inventory script for this one I'm gonna use what's called the bring your own inventory here and that will expose some of the things that it's doing but I think it'll be more informative to do it this way so I'm going to do that and so you we can note this path here inventory slash BYO would slash hosts so we're going to we're gonna go inventory bring your own if you look in here there's a couple of example files if you go into hosts origin example you you can go down here and see there are a ton of options that you can set I mean open shift is very tunable and this is pretty much all the tunable there our I'm not going to go over all of those I'm gonna try to go with a minimal host file here so I'm gonna open up a host file and then I've got a gist here that has a configuration that I've already made so I'm gonna start up instances in GCE when I do that the user sets up for me is the same as the SSH key that have pre-registered with my account so the user that I'm gonna log into the nodes in as is yes Jennings but I can do a sudo and become root and so this is that tells ansible that you can just sudo as this user and it'll it'll just work the deployment type here I've set to origin it can also be open Jeff enterprise if you were doing a SunRail but we're not gonna do that we're gonna use origin on CentOS we're also gonna do a containerized install and this is the tag that we're the container tag that we're gonna be pulling from the docker hub which is 1.3.1 which is the currently the latest stable version this tells it to install the the example templates and that'll give us something to deploy on this open shift cluster once we get it installed here for the identity provider that there's lots of identity providers for openshift but for the demonstration purposes here I'm just going to use one of the basic ones which is the HTT p-- a sport auth and here I've just got a demo user and this is the hashed password for demo so demo demo is the user that we're creating by default here we're saying our openshift router which I'll explain a little bit later should be deployed on to the node with the region labeled infra and that's gonna be our in Freneau here you can see that openshift node labels region infra that means that this the the OpenShift router is going to be redeployed to this node every time and we're doing gonna do the same thing for the registry and then for all projects that are created by users we're gonna say we want those pods deployed to nodes that have region equals primary reset so we've got basically worker nodes here and then in special infrastructure node here here we list the masters this is a domain that I own and you'll see I'm gonna update the DNS here in a little bit so that you can have nice names for everything one thing is if you don't set this it's gonna default to the IP address the public IP address of the instance in the cloud which you may or may not want it that works every time but not many people are gonna remember the IP address of their master so if you want a DNS resolver well Pub public hostname yet to provide it here if the DNS name of the master doesn't have a reverse lookup so here under nodes we still have to put the master here so the master can be part of the SDN that's just the way the software-defined network that openshift sets up that's just I can that's just the way it has to be and then here are actual nodes the master will be added as a node but it will be not not schedulable by default since in a multi node setup you typically don't want the master running pods so that explains that we're gonna take all this and paste it in here make sure that happened all right so the next thing we're gonna do is we got a pre create our instances here so I'm gonna do this on Google cloud platform the GCE compute engine so if you've got a Google account you can get a GCE account with a $300 initial credit for free so that's actually what I'm using here I've already signed up so I can't show you that process but this you'll come to this if you go in here and you go to compute engine this is the page that comes up so we're gonna create an instance we're gonna create several instances first we're gonna create a master I like to use the one CPU 3.75 gigs of memory the master doesn't need a whole lot of memory unless you're running a large cluster so this works well enough here here we're gonna go sent us seven also in here I'm gonna do an SSD for system disk it's a little bit more expensive but you get better form disk performance and since containers in general are disk intensive it's worth it they're in my opinion so we're gonna do that the next so one more thing we're going to do is I'm going to tag this with master and I'll show you why later great all right well create another one this is gonna be our in Freneau it's the same size they're same this Center seven then we're gonna add a tag infra create that and then we're gonna create our two nodes node one we're gonna make a note since they're gonna actually be running the pods do that do that sure great actually I'll to go back to node one it and remove the info tag it saves those from creation to creation you have to remove it if you don't want on the next one no do back here no info tag create okay so we have that we have the foundation of our cluster here let me go into node one at it and we want to remove the tags so here does in front remove that tag alright save that and then once we have that saved we need to for me I set up DNS so that I don't have to do this by IP address and it makes it a little cleaner it also makes the route so we're gonna set up later more human readable friendly so here I'm gonna open up here and go into networking to save time I've already created the zone here let's go to cloud the NS while we're here let me look at the firewall rules so the reason we tagged the infra node and the master node with those infra and master tags was here so for the infrastructure node we want to pass through port 80 and and 443 so that's HTTP and HTTPS because it's going to be running the OpenShift router which is going to be listening on those ports for the load balancer and then for the master or the master console runs on 8 4 4 3 so we want to pass that through and then so setting those tags on the instances allow these firewall rules to apply to them if we go to cloud DNS I've added my domain here and I've got records for each of the things because though he was using ephemeral IP addresses before I need to update this so I will show you how to do that when I try to do that quickly here because it's a little tedious but we'll just copy that that's infra here set that master this is noted one looks like that doesn't actually change and no - okay so let's double check this by 4 1 6 3 2 5 2 107 ok so if we come here we do ping master alright we're getting our resolution there 163 163 that's what we want okay then there's one down here this will come up later and this was in if I go back to my gist here you can see that I've set up the router default sub domain to be Origin dot s change at me and that matches this wild-card DNS so basically I can create routes and OpenShift and they will always be directed to the infrared node where the router is running okay so I got DNS setup we got all that set up ok so we've got our host file here I'm gonna go back to our OpenShift ansible and i'm ends from here and now that we've got the nodes set up and everything in figured we're ready to pull actually deploy OpenShift so the command for that is ansible playbook and we're gonna use playbook bring your own config gamal is what we want to write so I'm gonna hit that and you and this will take a while it'll it's basically SSH into all of the nodes and the nodes in the master and configuring every so this could take depending on the speed of your connection and how fast the cloud is on in particular day 10 to 15 minutes so I'm going to cut here and then at the end I'll show you at the end and then log into the console deploy a sample app and we can see that it's all working ok so that completed that took about 15-20 minutes on my box so just give you a expected time there so first thing I'm going to do is log into the master node and if you want to do anything at the cluster admin level you need to do this the demo user that we set up is just a normal user doesn't have any cluster level roles but if you do it if I log into the master the Installer has installed the client utilities for me and set my cube config right so if I do OC get nodes we can see all the nodes here so here's the master it's a node but it's the scheduling disabled so that pods won't be deployed to it here's our in Freneau dhond then our two worker nodes so if you want to do anything at a cluster admin level you have to do it from the command line or grant cluster level roles to user that you create so if we come over here and we go to its BPS master so it uses a self-signed cert in the Installer to secure among all the components and and for the web console so you have to you know accept that and then log in as the user that we specified in the ansible installer inventory file which was demo demo and our cluster is running so we can even deploy a new project here so it's like a demo project and come in here and we can do this cakephp my sequel example so that'll deploy a pod and we'll test to make sure that our build pipeline is working that it will pull pull down code from github build it create and a container image push that to the internal registry and then deploy it to our nodes so we don't actually have to change anything there you can scroll straight to the bottom and it create and if we go back to the main console here you can see that it is that it's building things so my sequel it just pulls that image straight down from docker hub so that will deploy quickly and then the cake my sequel example actually has to build from source so we can go look at the log on that you should see it cloning the repository and building the image here which shouldn't take too long and this is one of the really nice things about open chef especially the web console it gives you a lot of information about what's going on and you can do do lots of debugging in this particular install we didn't do install the metrics or the logging facilities for OpenShift but those can also be deployed from the ansible installer as well as a cloud provider integration with AWS GCE and OpenStack which can provide additional functionality that OpenShift can kind of reach down into the cloud layer and do things automatically for you which is pretty nice so right now so this is our internal image registry here this is the openshift image registry and so it pulled down the source from github built the PHP application and now it's it created the container basically doing a docker build inside the inside this builder container and has pushed the container to our internal registry and so if we come out to the overview again we've got our deployer running and we should see this pod come up you're pretty soon this this deployment actually has a aliveness probe on it so it won't it won't actually show as ready on the dashboard until is actually responding to requests so if we look at this where our pot is up now and this is where the origin dot s gangs got me wildcard DNS can'tcan't comes up this is so by default that names it the name of the name of the service and the project and then whatever we set there in that ansible install so if I hit that you can see that our application is up and running and the view count is - even though I've only viewed this page once it's counting the view counts from the from the health monitoring and the liveness probe so so that is a way to install openshift in four node cluster in GCE if you haven't done the free trial with GCE yet then all this is for free as well so hopefully you give that a try and I give it and just the explore would open Jeff can do for you
Info
Channel: Seth Jennings
Views: 7,754
Rating: 4.8947368 out of 5
Keywords: openshift, kubernetes, red hat, containers, docker, orchestration, centos, gce, ansible
Id: 1Lo10hLC2XE
Channel Id: undefined
Length: 18min 7sec (1087 seconds)
Published: Wed Nov 09 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.