1 00:00:01,170 --> 00:00:06,390 As I've repeated several times now we're going to create a cluster IP service to allow access to our 2 00:00:06,390 --> 00:00:09,370 post pod and one for event buzz as well. 3 00:00:09,370 --> 00:00:10,100 So let's get to it. 4 00:00:11,980 --> 00:00:17,350 Back and said my editor we can either create a new file to house these two services or I should say 5 00:00:17,350 --> 00:00:18,880 one file for each service. 6 00:00:19,030 --> 00:00:24,670 Or alternatively we can just write out the configuration for each cluster IP service directly into the 7 00:00:24,670 --> 00:00:26,860 appropriate deployment file. 8 00:00:26,870 --> 00:00:33,110 Personally I kind of like to co locate my deployment configuration and the IP service that maps up to 9 00:00:33,110 --> 00:00:33,310 it. 10 00:00:33,440 --> 00:00:38,480 And the reason for that is that we usually end up with a one to one mapping between cluster IP services 11 00:00:38,780 --> 00:00:41,600 and the deployments that they are allowing access to. 12 00:00:41,600 --> 00:00:46,280 So it kind of makes sense in my mind to collect all this stuff but you will find that other people like 13 00:00:46,280 --> 00:00:51,500 to create a separate file for every single service or I should say every single object inside their 14 00:00:51,520 --> 00:00:52,730 communities cluster. 15 00:00:52,730 --> 00:00:58,640 So it's really up to you but at least in this course we're going to co-located all this configuration. 16 00:00:58,790 --> 00:01:04,040 That means that inside of my event bus deployment file I'm gonna go down to the very bottom of the file 17 00:01:04,340 --> 00:01:09,920 and we're going to write out the configuration to create this new cluster I.P. service right here to 18 00:01:09,920 --> 00:01:13,190 create multiple objects inside of a single e-mail file. 19 00:01:13,190 --> 00:01:17,870 We add on dash dash dash and then just go down to the next line. 20 00:01:18,650 --> 00:01:24,220 So we will write out our configuration for the cluster IP service starting right here the configuration 21 00:01:24,220 --> 00:01:28,530 we're going to write out is going to look just about identical to what we wrote out already inside the 22 00:01:28,560 --> 00:01:39,550 post SRB file so let's get to it to create this cluster I.P. service will say API version 1 kind is 23 00:01:39,550 --> 00:01:48,630 going to be service metadata is going to have a name of event plus SRB 24 00:01:52,660 --> 00:01:57,560 I'll then create a spec inside of here we're going to once again setup a selector that's going to tell 25 00:01:57,560 --> 00:02:01,300 the service what pods it is going to allow access to. 26 00:02:01,370 --> 00:02:06,740 So in this case we want to use or we want to make sure that we tell the service to direct any incoming 27 00:02:06,740 --> 00:02:13,580 traffic to the pod with a label of event app event dash bus that's going to be the label that we're 28 00:02:13,580 --> 00:02:21,640 going to look for right there so we will provide that label to the selector field the app event Dash 29 00:02:21,730 --> 00:02:28,420 Plus next step we can optionally specify a type of cluster IP. 30 00:02:28,450 --> 00:02:33,850 The reason I say optionally is that if we do not specify a type for the service companies will default 31 00:02:33,850 --> 00:02:38,680 to creating a cluster IP service for us so we can delete that altogether if we want to and we will just 32 00:02:38,680 --> 00:02:43,540 go ahead and get a cluster IP service it is 100 percent up to you whether or not you want to write out 33 00:02:43,540 --> 00:02:48,700 the full type or just rely upon the default behavior for me personally I think I'll go at the default 34 00:02:50,000 --> 00:02:51,910 so I'm not going to include it. 35 00:02:52,130 --> 00:02:59,670 And then finally we'll set up our ports as a quick reminder the event bus application itself. 36 00:02:59,670 --> 00:03:06,000 If we open up its implementation specifically the index dot J as file this thing is listening to incoming 37 00:03:06,000 --> 00:03:08,040 traffic on port four thousand five. 38 00:03:08,400 --> 00:03:13,510 So we just need to make sure that we specify a port of four thousand five in the port configuration. 39 00:03:13,740 --> 00:03:16,580 It's all but a dash in say name event. 40 00:03:16,610 --> 00:03:27,030 Bus protocol of DCP then a port of four thousand and five and a target port of four thousand and five. 41 00:03:27,030 --> 00:03:34,580 Like so an attribute I'm going to say this file and then going to go back over to my terminal and I'll 42 00:03:34,600 --> 00:03:41,300 try to apply it right away I'm still inside of my k aides directory and I'll do a cube Seitel apply 43 00:03:43,630 --> 00:03:51,440 event bus depot dot yellow once I run that command you'll see that Cuban net now understands that there 44 00:03:51,440 --> 00:03:57,170 are two objects that we are defining inside that config file the event plus deployment has been unchanged 45 00:03:57,410 --> 00:04:02,060 so although we tried to apply some changes we haven't actually or apply that same file again we haven't 46 00:04:02,060 --> 00:04:06,950 actually made any changes to the deployment but Cuban eddies did realize that the event by service was 47 00:04:06,950 --> 00:04:14,210 brand new and so it listed it as being created which Nashville to do a cube Seitel get services and 48 00:04:14,210 --> 00:04:20,040 see our event bus service right there and it should have a type of cluster IP awesome now looks pretty 49 00:04:20,040 --> 00:04:28,260 good now we're going to repeat that same process where our posts as well before we do so however you'll 50 00:04:28,260 --> 00:04:34,710 recall that we've already created a note port right here and it's already using this name of post SRB. 51 00:04:34,710 --> 00:04:40,590 So we just need to be aware that once we create a second service that's going to direct to this post 52 00:04:40,590 --> 00:04:41,680 pod right here. 53 00:04:41,680 --> 00:04:48,330 Once we create this second cluster IP in addition to the node ports that already points to it we just 54 00:04:48,330 --> 00:04:50,630 need to make sure that we use some slightly different names. 55 00:04:50,700 --> 00:04:55,740 Otherwise Cuban that is is going to think that we want to try to change the existing node port service 56 00:04:55,830 --> 00:04:57,750 into a cluster IP. 57 00:04:57,810 --> 00:05:01,640 I mean to say is we just need to use a different name than the one that we already used inside this 58 00:05:01,670 --> 00:05:09,460 post SRB file going to open up the post deployment file and once again we're gonna write out the cluster 59 00:05:09,460 --> 00:05:14,620 IP service that's going to allow access to the pod created for this deployment down here at the very 60 00:05:14,620 --> 00:05:21,550 bottom it's all put in dash dash dash and then rather than writing all this stuff out again let's just 61 00:05:21,550 --> 00:05:27,650 do some copy paste I'm going to go back over to the event event plus deployment file and copy everything 62 00:05:27,650 --> 00:05:33,260 down here go down to a post dash deployment and paste it all in 63 00:05:37,340 --> 00:05:50,240 and then finally I'll change the name of this cluster I.P. service to those luster IP dash SRB again 64 00:05:50,270 --> 00:05:55,120 that's just going to distinguish between the existing post service we've already created then make sure 65 00:05:55,120 --> 00:06:03,560 that I update the selector right here to post and I'll update the name of the port to post as well finally 66 00:06:03,920 --> 00:06:09,720 recall that we have some different ports where our post application if we open up the posts indexed 67 00:06:09,750 --> 00:06:14,630 not just file this thing lists traffic on Port 4000 we just have to make sure that we update that port 68 00:06:16,320 --> 00:06:23,130 and that should be at I'll save this file and once again we'll go over to our terminal and we'll do 69 00:06:23,160 --> 00:06:33,140 a cube CTO apply those double dot e-mail Oh don't forget the F on their dash F so we've now created 70 00:06:33,140 --> 00:06:41,620 that cluster IP service that points over it suppose and if I do a cube CDL get services e up there it 71 00:06:41,620 --> 00:06:43,810 is right there all right. 72 00:06:43,830 --> 00:06:47,790 Once again I want to repeat that I know a lot of this stuff seems tedious right now and as soon as you 73 00:06:47,790 --> 00:06:50,500 get through this one time of doing all this stuff by hand. 74 00:06:50,600 --> 00:06:53,310 A lot of it is going to get way way easier. 75 00:06:53,310 --> 00:06:57,180 And again I want to also repeat that I'm sure a lot of this Cuban neti stuff seems kind of pointless 76 00:06:57,180 --> 00:06:57,670 right now. 77 00:06:57,690 --> 00:07:03,150 You might be saying there's no way all this trouble is worth it but trust me once we get a really good 78 00:07:03,150 --> 00:07:09,040 Cuban that flow going adding in new stuff or new components to our micros services application is going 79 00:07:09,040 --> 00:07:10,710 to be an absolute breeze. 80 00:07:10,710 --> 00:07:11,750 So I can't repeat enough. 81 00:07:11,760 --> 00:07:15,140 It's really just some onetime pain to learn this stuff and we're almost done. 82 00:07:15,150 --> 00:07:19,020 Anyhow OK so this is looking pretty good. 83 00:07:19,050 --> 00:07:24,240 We have now gone through building image we push the image we create a deployment we create the cluster 84 00:07:24,270 --> 00:07:30,510 IP services now we just have to do one last little step to wire the stuff up and then our two event 85 00:07:30,510 --> 00:07:35,450 bus and posts or these two pods will yield to communicate with each other very easily. 86 00:07:35,450 --> 00:07:37,050 So a quick pause and I'll see you in just a minute.