1
00:00:00,920 --> 00:00:05,150
In the last section we finally applied our first deployment to our local cluster.

2
00:00:05,180 --> 00:00:10,130
Now just to make sure that everything is working the way we expect or want to try to connect to the

3
00:00:10,520 --> 00:00:14,870
container inside of that pod running the multi client image.

4
00:00:15,050 --> 00:00:19,880
And when we connect to it we should see that little re-act application appear on the screen.

5
00:00:19,880 --> 00:00:24,580
So I want you very quickly to remember how we connect to our local cluster.

6
00:00:24,620 --> 00:00:26,220
We do not use localhost.

7
00:00:26,300 --> 00:00:31,000
We have to run that mini cube IP command.

8
00:00:31,280 --> 00:00:37,330
Remember that mini cube virtual machine that is our local node has its own IP completely different from

9
00:00:37,390 --> 00:00:38,580
localhost.

10
00:00:38,650 --> 00:00:44,350
So we need to first run many cube IP once we get the IP address we'll then make sure that we connect

11
00:00:44,350 --> 00:00:52,170
to the port those associated with that service that we created which was hardcoded to be 3 1 5 1 5.

12
00:00:52,210 --> 00:00:57,660
So back at my terminal I'll do mini cube IP there is the IP of my virtual machine.

13
00:00:57,770 --> 00:01:06,230
I'll copy it or make a new tab inside my browser and then I'll put on Colan 3 1 5 1 5 because again

14
00:01:06,230 --> 00:01:09,500
that is the hard coded port of our service.

15
00:01:09,500 --> 00:01:14,570
And when I do so I do in fact successfully see my application appear on the screen.

16
00:01:14,570 --> 00:01:16,030
Awesome.

17
00:01:16,040 --> 00:01:20,540
Now this is actually going to be a really good time to start to understand why we use these service

18
00:01:20,540 --> 00:01:23,690
things like why do we have to create that service object.

19
00:01:23,690 --> 00:01:28,990
Why were we not able before to just directly connect to one of our pods that was running the container

20
00:01:29,000 --> 00:01:30,140
that we care about.

21
00:01:30,470 --> 00:01:35,120
Well now that we understand the idea behind deployments understanding why we have to how these service

22
00:01:35,120 --> 00:01:37,940
things is going to make a lot more sense.

23
00:01:37,940 --> 00:01:44,020
So one thing I want to show you very quickly back over at your terminal try running the command cube

24
00:01:44,020 --> 00:01:52,050
see T.L. get pods and then we're going to add on an argument here of dash so wide like so that's going

25
00:01:52,050 --> 00:01:56,990
to still get our list of pods but it's going to depend on a little bit of additional information.

26
00:01:57,000 --> 00:02:00,930
Now I'm going to zoom out here really quickly just so I can see a thing on a single line.

27
00:02:00,930 --> 00:02:02,480
There we go.

28
00:02:02,490 --> 00:02:07,570
Now I want you to notice how we now have these IP and note columns over on the right hand side.

29
00:02:07,590 --> 00:02:12,300
Now the really important column to take notice of here is the IP column.

30
00:02:12,600 --> 00:02:17,950
Every single pod that we create gets its own IP address assigned to it.

31
00:02:18,210 --> 00:02:22,640
So we just deployed our deployment just two seconds ago and that created a pod.

32
00:02:22,650 --> 00:02:27,810
It was randomly assigned an IP address of 1 7 2 1 7 0 6.

33
00:02:27,810 --> 00:02:32,610
This is an IP address that is internal to our virtual machine.

34
00:02:32,730 --> 00:02:37,400
So you and I cannot visit that IP or at least we cannot visit it very easily.

35
00:02:37,440 --> 00:02:42,560
It is an IP address that has been assigned to the pod inside of our node right here.

36
00:02:43,730 --> 00:02:49,460
Now the interesting thing about that is that if this POD ever gets deleted or if an additional one is

37
00:02:49,460 --> 00:02:56,270
created or for any reason the pod gets updated or changed in any way shape or form whatsoever it's entirely

38
00:02:56,270 --> 00:03:01,340
possible that the pod might suddenly get a brand new IP address.

39
00:03:01,340 --> 00:03:07,280
So let's imagine that this pod right here has that IP address of something like I know though 1 7 2

40
00:03:07,500 --> 00:03:09,050
0 0 0 0 1.

41
00:03:09,050 --> 00:03:11,690
We'll just kind of make up an IP address like so.

42
00:03:12,050 --> 00:03:17,750
So I want you to imagine if we figured out some way to connect our browser to a pod running directly

43
00:03:17,780 --> 00:03:25,100
inside of our node then inside of our browser we would type in something like 1 7 2 0 0 1 and then we

44
00:03:25,100 --> 00:03:26,920
would probably want to connect to port 3000.

45
00:03:26,920 --> 00:03:30,820
So we'd probably put on Colin 3000 or something like that.

46
00:03:30,830 --> 00:03:37,010
Now the problem starts to arise if we start to recreate this pod right here because maybe we have to

47
00:03:37,280 --> 00:03:42,500
remake it because our configuration has changed on the deployment or maybe the original pod crash or

48
00:03:42,620 --> 00:03:45,000
whatever reason it might be.

49
00:03:45,110 --> 00:03:51,950
And so we can imagine that maybe we have to create a second pod and this one would get a randomly generated

50
00:03:51,970 --> 00:03:58,500
IP of something like 0 0 or 2 and then maybe this original pod gets deleted.

51
00:03:58,750 --> 00:04:05,170
Well now we originally had an IP address of 1 7 2 0 0 1 that IP addresses are not going to work anymore

52
00:04:05,320 --> 00:04:11,360
because the object or the pod associate with it just plain no longer exists.

53
00:04:11,380 --> 00:04:17,740
And so in order to access this pod right here we would in theory now have to manually type in that 00

54
00:04:17,740 --> 00:04:19,270
to like so.

55
00:04:19,300 --> 00:04:24,310
Now as you might guess having to update the IP address all the time inside your browser in a development

56
00:04:24,310 --> 00:04:30,590
environment would definitely be a big pain and that's why we make use of these service objects.

57
00:04:30,610 --> 00:04:36,820
The service is going to watch for every pod that matches its selector because remember that service

58
00:04:36,820 --> 00:04:38,180
has a selector.

59
00:04:38,290 --> 00:04:45,020
If we look at client no ports e-mail it has the selector of component where so the service is going

60
00:04:45,020 --> 00:04:51,490
to look for every pod with that selector and then automatically route traffic directly over to it.

61
00:04:51,500 --> 00:04:55,980
So that's why we make use of the service these pods are coming and going all the time.

62
00:04:56,090 --> 00:05:01,280
They're getting deleted they're getting recreated and every time they potentially might get assigned

63
00:05:01,340 --> 00:05:07,040
a brand new IP address the service is going to kind of abstract out that difficulty and that's why we

64
00:05:07,040 --> 00:05:08,430
make use of these services.

65
00:05:08,510 --> 00:05:11,880
And each time that we want to connect to one of our different pots.

66
00:05:12,260 --> 00:05:12,500
OK.

67
00:05:12,500 --> 00:05:15,620
So hopefully that gives you a better idea of why we care about these service things.

68
00:05:15,620 --> 00:05:18,850
So let's take a quick pause right here and we'll continue in the next section.
