WEBVTT 00:00.190 --> 00:06.300 In this demo, we're going to take a look at services in coconut's and the previous demo. 00:06.450 --> 00:09.090 We created a few parts by creating a deployment. 00:09.510 --> 00:11.520 So let's check the status of that first. 00:13.870 --> 00:16.710 So we have a deployment called my app Dash Deployment. 00:17.430 --> 00:23.070 And it has six replicas, which is essentially six parts running in the cabinet as cluster. 00:25.560 --> 00:30.510 So now we have an application which is created to run on this cluster. 00:31.350 --> 00:37.560 But in order for the end user to access it on their Web browser, we have to create a service. 00:38.350 --> 00:41.520 And to do this, let's jump back to our editor. 00:42.480 --> 00:47.140 We have created a new directory called Service and within the service directory. 00:47.250 --> 00:51.060 We're going to create a new file called Service Definition Dot YAML. 00:52.500 --> 00:57.510 Not that you don't really need to follow this directory structure as I'm doing. 00:57.540 --> 01:00.180 I'm just following it to organize the examples. 01:01.050 --> 01:03.480 You could simply have all the files in the same location. 01:04.050 --> 01:09.180 And just like before, the first thing that goes in is the root element. 01:09.270 --> 01:10.200 The API version. 01:10.410 --> 01:14.310 And for service, it should be said to be one for kind. 01:14.340 --> 01:15.930 We're going to specify service. 01:16.680 --> 01:18.840 So let's look that up from the list. 01:18.960 --> 01:25.500 And we're going to add metadata with the name of the service, which you can say my app, the service. 01:27.560 --> 01:31.580 And this and underneath that, we're going to add the peg section. 01:33.130 --> 01:39.550 And the first property that we will create is the type of service which we will set to node port. 01:41.000 --> 01:48.530 Now, our goal is to be able to access our application on a port, on the node, which is the mini cube 01:48.530 --> 01:49.790 node in our case. 01:50.510 --> 01:57.470 And then we will add the port and the default port and which Engine X listens, which is 80. 01:58.070 --> 02:03.600 And we're also going to add our target port, which is also port 80. 02:03.710 --> 02:06.110 So this is basically the port on the service itself. 02:06.980 --> 02:12.110 And next, we're going to add a node port, which we can set to a value suggests. 02:12.640 --> 02:13.670 Thirty thousand four. 02:13.790 --> 02:19.400 So it could be any value between thirty thousand and thirty two thousand seven hundred sixty seven. 02:20.690 --> 02:28.520 And this node port east is the port on the node, the worker node, which is the mini cube node on which 02:29.120 --> 02:30.980 the application will be made accessible. 02:32.000 --> 02:38.900 Next, we're going to add a selector which helps us bind our service to the port with the same label. 02:38.930 --> 02:45.850 So quickly, let's check the deployment YAML file and you'll notice that the label for the port is app 02:45.890 --> 02:46.760 said to my app. 02:47.180 --> 02:50.570 So let us add the same value here under these selector section. 02:51.170 --> 02:57.080 So once this has been completed, our service definition file is complete and we can proceed to create 02:57.470 --> 02:59.090 these on our clusters. 02:59.700 --> 03:00.860 And I'm going to save it here. 03:00.890 --> 03:03.410 And Jim, back to my terminal. 03:04.010 --> 03:08.060 And let me navigate to the new directory that we created. 03:09.440 --> 03:12.260 And here is our service definition file. 03:13.790 --> 03:19.910 So I'm going to create these service using the cubicle, create command with the dash F option and specify 03:19.940 --> 03:23.240 the service definition YAML file as the input. 03:24.250 --> 03:27.200 I run this command and the service has been created. 03:28.250 --> 03:30.860 We can now run the cubicle, get service command. 03:31.190 --> 03:38.720 And here you'll notice that the new service is visible and the type of the service is node port, which 03:38.990 --> 03:42.950 because we want it to be accessible on the port, on the worker node. 03:43.580 --> 03:46.700 And here is a cluster IP, which is also created for the service. 03:47.170 --> 03:52.850 Now it's an address created for the service within the Internet internal cluster network. 03:53.660 --> 03:58.550 And here is a port on the worker node that we can use to access our application. 03:59.180 --> 04:05.030 So if you know the IP of the worker node, you can simply go to a browser and just type in the IP of 04:05.030 --> 04:06.850 the worker node followed by the port. 04:06.860 --> 04:07.180 No. 04:07.550 --> 04:09.830 And you should be able to access this application. 04:10.550 --> 04:16.670 Now, since we are running this on many KUB now, we can also run the mini tube service command, followed 04:16.670 --> 04:19.340 by the name of the service, which is the MAI app. 04:19.590 --> 04:23.120 That's service and use the option that as you are. 04:23.960 --> 04:28.160 And it should print does the euro with the service. 04:28.400 --> 04:29.720 Where the services available. 04:30.440 --> 04:34.230 So let's try to access this on a browser so you can just copy this. 04:34.250 --> 04:43.380 You are l go to a browser and paste that you are all in the browser and we see that the default engine 04:43.380 --> 04:44.210 X Web page. 04:44.960 --> 04:52.550 So that confirms that the Engine X application is up and running and we're able to access it on a web 04:52.550 --> 04:53.090 browser. 04:55.430 --> 04:59.070 Well, that's it for this demo, and we'll see you in the next one.