1
00:00:00,270 --> 00:00:05,200
Next up is we're going to deploy our Java image in the cluster.

2
00:00:05,580 --> 00:00:11,790
We have everything ready for that so we can now create a deployment file cabinets configuration file

3
00:00:12,120 --> 00:00:12,640
to do that.

4
00:00:12,960 --> 00:00:21,150
It's also a common practice that usually have the community's deployment files inside the project repository

5
00:00:21,450 --> 00:00:24,090
for their applications deployment.

6
00:00:24,600 --> 00:00:30,030
Sometimes they also have a separate repository with all the communities configuration files there.

7
00:00:30,180 --> 00:00:37,560
That's also a case, but we're going to create a YAML file for deployment in the repository of the project

8
00:00:37,560 --> 00:00:38,050
itself.

9
00:00:38,370 --> 00:00:40,860
So let's go and create deployment.

10
00:00:42,450 --> 00:00:45,180
Yamal deployment.

11
00:00:48,210 --> 00:00:55,170
So I have made the ed a little bigger, so this is going to be a very basic, simple deployment configuration

12
00:00:55,170 --> 00:01:00,030
file because we don't have any external configuration for application.

13
00:01:00,060 --> 00:01:01,790
It's a pretty basic one.

14
00:01:02,310 --> 00:01:04,520
So this is the first part of a deployment.

15
00:01:04,530 --> 00:01:09,120
We have the kind of metadata we just got to call it Java EB.

16
00:01:09,330 --> 00:01:13,410
And this is the specification where we define replicas.

17
00:01:14,160 --> 00:01:23,310
We can start with one, then we have the selector and here we are going to match labels.

18
00:01:26,790 --> 00:01:35,130
For the parts we're going to call the Java as well, and this is the template or blueprint for the port

19
00:01:35,130 --> 00:01:35,620
itself.

20
00:01:36,060 --> 00:01:40,590
And here we also have the metadata, just like here.

21
00:01:40,950 --> 00:01:42,840
I'm actually going to copy that.

22
00:01:43,830 --> 00:01:45,830
So we have the same metadata.

23
00:01:45,840 --> 00:01:47,130
We don't need the name here.

24
00:01:47,160 --> 00:01:53,020
You can just use the labels metadata and spek just like here.

25
00:01:53,310 --> 00:01:59,900
So here in the specification, we have the list of the containers that are going to run in the pot.

26
00:02:00,420 --> 00:02:06,390
So we're going to say containers and we just have one container.

27
00:02:06,900 --> 00:02:10,620
We can also call it Java, if not very creative.

28
00:02:10,620 --> 00:02:12,780
But let's just have Java everywhere.

29
00:02:13,050 --> 00:02:16,320
And this is where we specify the image.

30
00:02:16,680 --> 00:02:22,910
Now, the image, the image URL sort to say for Java EP is actually right here.

31
00:02:23,070 --> 00:02:29,070
So next to each tag, you have this command to pull the image and this is the image URL.

32
00:02:29,490 --> 00:02:32,730
So let's copy that one here.

33
00:02:32,730 --> 00:02:38,730
You're going to have your doctor ID the name of the repository and the tag.

34
00:02:39,120 --> 00:02:39,690
That's it.

35
00:02:41,040 --> 00:02:48,300
Another thing we need to configure here is ports so you can also have a list of ports in case your application

36
00:02:48,510 --> 00:02:51,090
is running and listening on multiple ports.

37
00:02:51,390 --> 00:02:55,880
We have exposed Port 80.

38
00:02:56,730 --> 00:02:58,230
So this is the same one here.

39
00:02:58,860 --> 00:03:04,980
This is where the container will listen and that will be the configuration of the deployment.

40
00:03:05,340 --> 00:03:12,930
No, in order for Docker to be able to pull that image from the repository, it needs to have access

41
00:03:12,930 --> 00:03:14,580
to that secret that we created.

42
00:03:14,850 --> 00:03:22,740
So the Docker registry secret and the way we provide Docker, the reference to that secret inside the

43
00:03:22,740 --> 00:03:30,810
deployment configuration file is using another attribute called Image Pull Secrets.

44
00:03:32,700 --> 00:03:35,750
And note here that it is at the same level as containers.

45
00:03:35,940 --> 00:03:41,120
So you have one for the whole port and you can use it for all the containers.

46
00:03:41,130 --> 00:03:42,270
It's also a list.

47
00:03:44,010 --> 00:03:50,250
We are just going to provide one here and that is going to be the name of the secret that we created.

48
00:03:50,940 --> 00:04:02,340
Our secret is called Docker Registry SEKRET, and that will make it possible to pull this image from

49
00:04:02,340 --> 00:04:03,110
the repository.

50
00:04:04,020 --> 00:04:09,040
And the last thing we want to add here is image pool policy.

51
00:04:09,630 --> 00:04:18,870
So basically, every time the port starts, we want it to pull the image in case we make some changes.

52
00:04:20,250 --> 00:04:25,410
So it will force the pod to refresh the image every time it restarts.

53
00:04:25,840 --> 00:04:26,160
Right.

54
00:04:26,430 --> 00:04:33,390
So by default, when you have a fixed tag instead of a latest, it will check that it has that image

55
00:04:33,390 --> 00:04:35,640
already pulled in a local repository.

56
00:04:35,790 --> 00:04:41,280
So it won't try to refresh it from the repository, which is pretty efficient in some cases where you

57
00:04:41,280 --> 00:04:42,990
always renew the tag.

58
00:04:43,990 --> 00:04:46,560
But here we are just going to define image code policy.

59
00:04:46,560 --> 00:04:53,360
So it always refreshes, even if that exact image version is available locally.

60
00:04:53,910 --> 00:04:55,230
So let's save that.

61
00:04:55,230 --> 00:04:58,670
And now we are ready to apply that deployment.

62
00:04:58,920 --> 00:05:02,730
So I'm going to go back to my comment line and let's apply that file.

63
00:05:03,510 --> 00:05:08,380
So it's in Java app root directory and that will be.

64
00:05:08,880 --> 00:05:10,440
So the deployment got created.

65
00:05:10,710 --> 00:05:14,760
So now let's check the status of our port and it's running.

66
00:05:15,000 --> 00:05:23,250
We can also see the logs of the container and we should see the logs in Jason format.

67
00:05:23,670 --> 00:05:24,630
And that's it.

68
00:05:25,600 --> 00:05:26,710
This is what we're logging.

69
00:05:27,030 --> 00:05:29,960
This is our null pointer exception.

70
00:05:30,180 --> 00:05:31,380
Everything looks fine.
