1
00:00:00,000 --> 00:00:10,400
Hi, let us understand about services. Earlier we saw the deployments, pods,

2
00:00:10,400 --> 00:00:14,933
replica sets and that's going to make sure n number or desired number

3
00:00:14,933 --> 00:00:20,466
of pods up and running. Now each and every pod will be having an internal IP

4
00:00:20,466 --> 00:00:25,366
address and that will not be accessible from the outside world and that's part of

5
00:00:25,366 --> 00:00:29,032
networking, let's not get into this at this stage we will be having detailed

6
00:00:29,033 --> 00:00:34,999
discussion later and since the internal IP address is not accessible I need some

7
00:00:35,000 --> 00:00:40,166
sort of an abstract way to expose the application, so that the pods can be

8
00:00:40,166 --> 00:00:44,132
accessed from the outside world and that's where the service comes into

9
00:00:44,133 --> 00:00:50,233
picture and there are different ways I can expose the IP address use that DNS and

10
00:00:50,233 --> 00:00:55,566
use a load balancer. I'm going to go with a very simple option of mapping it to the

11
00:00:55,566 --> 00:01:01,332
node port and expose the service or the pod to the outside world. For that I am

12
00:01:01,333 --> 00:01:06,733
going to create a service, let me get the details about the service yaml file. I do

13
00:01:06,733 --> 00:01:13,399
have a sample yaml file service.yaml where I do have the kind as service. Here I

14
00:01:13,400 --> 00:01:20,400
do have the specs where within the ports I am going to expose the node port 30200

15
00:01:20,400 --> 00:01:26,400
and that will be targeting to the port 80 of the container or the pod which are

16
00:01:26,400 --> 00:01:32,066
having the selector or the label as app. So it's going to again use the selector and

17
00:01:32,066 --> 00:01:39,199
select the pods using the selector it's going to route all the traffic that it is getting in port 30200

18
00:01:39,200 --> 00:01:44,833
to the port 80 of the container. So basically it's going to act like a load balancer and receive the

19
00:01:44,833 --> 00:01:51,199
request in port 30200 and route it to port 80 of the pod. So within the host it's going

20
00:01:51,200 --> 00:01:59,166
to get the request in port 30200 and it's going to route it to the port 80 of the

21
00:01:59,166 --> 00:02:03,666
container that is running within the pod and there are some restrictions

22
00:02:03,666 --> 00:02:07,866
available where the service can be started only within the ports ranges of

23
00:02:07,866 --> 00:02:14,799
30,000 to 32767. Let me go ahead and get the details about the current pods that

24
00:02:14,800 --> 00:02:20,800
are running, I can use the option dash o there is output with wide where I will be

25
00:02:20,800 --> 00:02:26,000
getting the IP address that is the internal IP address of these pods. Now directly I

26
00:02:26,000 --> 00:02:31,100
cannot access these pods, so what I'm going to do I'm going to create a service.

27
00:02:31,100 --> 00:02:36,833
Let me create a service using this specific service.yaml file and service should get

28
00:02:36,833 --> 00:02:41,433
created, let me go ahead and get the service so I do have the service in the

29
00:02:41,433 --> 00:02:46,599
name nginx and that's going to have the type as node port. For the time being don't

30
00:02:46,600 --> 00:02:51,200
worry about this particular type where I'm going to have a very high level overview

31
00:02:51,200 --> 00:02:55,000
on different concepts, in the detailed discussion we will discuss about

32
00:02:55,000 --> 00:03:00,766
different types and how to map the ports all other advanced discussions. Here I am

33
00:03:00,766 --> 00:03:00,966
mapping the port 30200 to the port 80. Let me go ahead and access specific port
different types and how to map the ports all other advanced discussions. Here I am

34
00:03:00,966 --> 00:03:06,432
mapping the port 30200 to the port 80. Let me go ahead and access specific port

35
00:03:06,433 --> 00:03:15,333
30200. Where I am getting into a specific pod or one of the pods within the replica

36
00:03:15,333 --> 00:03:20,099
set available within the deployment and I am getting the output, for time being

37
00:03:20,100 --> 00:03:24,000
we don't need to worry about which pod is serving this specific request and that

38
00:03:24,000 --> 00:03:28,433
can be very well identified using the custom php applications that we created

39
00:03:28,433 --> 00:03:33,566
earlier, deploy that and identify the IP address that we will be discussing it later

40
00:03:33,566 --> 00:03:38,199
point of time. So the quick takeaway or the summary about services is it's going

41
00:03:38,200 --> 00:03:44,033
to create an abstract layer and route the traffic to the pods available within the

42
00:03:44,033 --> 00:03:50,333
deployments or the replica sets. Again let me reiterate all we are saying is just a quick

43
00:03:50,333 --> 00:03:54,033
overview on different concepts so that we can get started on the

44
00:03:54,033 --> 00:03:57,366
detailed discussion about deploying the cluster and then getting

45
00:03:57,366 --> 00:04:00,932
back to the detailed discussion about these concepts.

