1
00:00:05,200 --> 00:00:06,910
No important notice.

2
00:00:06,910 --> 00:00:15,640
We just used imperative approach to creation of the deployments and services, and we create deployments

3
00:00:15,640 --> 00:00:19,060
and services using different CubeSat commands.

4
00:00:19,660 --> 00:00:27,010
But usually that's not the way how deployments and services are created, and in most cases declarative

5
00:00:27,010 --> 00:00:28,540
approach is utilized.

6
00:00:28,690 --> 00:00:35,890
And in declarative approach you have to create YAML configuration files which describe all the details

7
00:00:35,890 --> 00:00:43,510
for deployments and services, and afterwards apply those configuration files using CubeSat to apply

8
00:00:43,540 --> 00:00:44,200
command.

9
00:00:44,560 --> 00:00:51,700
And that's actually declarative approach of creation of different resources and objects in Kubernetes.

10
00:00:51,700 --> 00:00:54,160
And that's what we will do right now.

11
00:00:54,190 --> 00:00:58,840
Let's not delete both deployment and service, which we created before.

12
00:00:58,840 --> 00:01:05,770
And for that you could utilize command, cube style, delete deployment and afterwards delete service.

13
00:01:05,770 --> 00:01:13,750
But there is also short version of deletion of all resources in default namespace and it is delete all

14
00:01:13,870 --> 00:01:14,800
with option.

15
00:01:14,810 --> 00:01:16,450
There's dash all like that.

16
00:01:18,000 --> 00:01:20,610
All the resources will be deleted.

17
00:01:21,150 --> 00:01:27,990
You'll see that posts were deleted, service was deleted, and deployment was deleted as well.

18
00:01:28,230 --> 00:01:30,390
Let's get both.

19
00:01:31,110 --> 00:01:33,330
Both are still being terminated.

20
00:01:33,390 --> 00:01:34,650
Let's check again.

21
00:01:35,220 --> 00:01:36,600
Still terminating.

22
00:01:36,870 --> 00:01:37,980
Let's wait a bit.

23
00:01:38,700 --> 00:01:42,570
And now there are no resources found in default namespace.

24
00:01:42,570 --> 00:01:44,730
All ports were terminated.

25
00:01:44,760 --> 00:01:47,850
Let's get services k, get SBC.

26
00:01:48,600 --> 00:01:53,040
And now there was only a single default system service, Kubernetes.

27
00:01:53,040 --> 00:01:55,290
And of course, there are no deployments.

28
00:01:55,350 --> 00:01:56,760
Get, get, deploy.

29
00:01:57,690 --> 00:01:59,010
No resources found.

30
00:01:59,310 --> 00:02:05,700
Now let's create YAML configuration file for deployment and for service trust.

31
00:02:05,700 --> 00:02:08,729
We will create two separate configuration files.

32
00:02:09,090 --> 00:02:11,130
Let's go to Visual Studio code.

33
00:02:11,130 --> 00:02:19,020
And here let me, by the way, hide and by the terminal for the moment and let me close those all windows.

34
00:02:19,140 --> 00:02:23,550
And now here, let's collapse this folder gate as web.

35
00:02:23,550 --> 00:02:29,730
Hello, because this folder was dedicated to our Node.js Express Web application.

36
00:02:29,730 --> 00:02:37,650
And now here in the root of the k8s folder here, let's create following files deployment.

37
00:02:39,080 --> 00:02:44,990
But YAML and also let's create file service, not yaml like that.

38
00:02:45,410 --> 00:02:49,130
So two files deployment, yaml and service dot yaml.

39
00:02:49,340 --> 00:02:53,570
Let's first fill in deployment yaml file.

40
00:02:54,080 --> 00:03:01,880
If you installed Kubernetes extension here in voice code, what I asked you to do before you could create

41
00:03:01,880 --> 00:03:04,730
such configuration files very fast.

42
00:03:04,850 --> 00:03:05,870
Let me show you.

43
00:03:05,900 --> 00:03:07,480
So type here.

44
00:03:07,520 --> 00:03:08,960
Simply deployment.

45
00:03:09,710 --> 00:03:12,560
And you will see suggestion Kubernetes deployment.

46
00:03:13,160 --> 00:03:20,270
Let's select it and you will see that YAML configuration file will be created automatically for you.

47
00:03:21,500 --> 00:03:28,970
And you will see that all appearances of the make up will be highlighted and you could simply type the

48
00:03:28,970 --> 00:03:36,440
name of the deployment which you would like to set, and let's set name to K eight as same as we did

49
00:03:36,440 --> 00:03:37,010
before.

50
00:03:37,040 --> 00:03:40,040
But now we are using yaml configuration file.

51
00:03:40,040 --> 00:03:41,720
So K eight as well.

52
00:03:42,170 --> 00:03:42,640
Hello.

53
00:03:42,800 --> 00:03:48,170
Like that deployment name was set here.

54
00:03:48,170 --> 00:03:50,690
Was actual name for this deployment.

55
00:03:50,720 --> 00:03:53,450
Here was api version ops slash.

56
00:03:53,450 --> 00:03:58,300
The one here was selector with match labeled sku.

57
00:03:58,310 --> 00:04:06,230
And by this match label scheme, we specify which ports will be managed by this deployment.

58
00:04:06,980 --> 00:04:13,460
And below there is nested template and this template describes actually port.

59
00:04:14,090 --> 00:04:23,270
But here you don't need to specify kind of the template like that because this nested template for deployment

60
00:04:23,270 --> 00:04:32,660
template is always port, therefore kind here is not needed next for the ports which belong to this

61
00:04:32,660 --> 00:04:41,300
deployment here we set labels and label here is the same as label here in selector match labels.

62
00:04:41,300 --> 00:04:51,200
So this label and this label match here and next in spec key, we specify which containers we want to

63
00:04:51,200 --> 00:04:56,660
create in this port and there was just a single container with such name.

64
00:04:56,690 --> 00:04:58,910
Image is to be filled.

65
00:04:59,030 --> 00:05:03,260
We will replace this image placeholder now with real image.

66
00:05:03,800 --> 00:05:11,120
And also below you could specify which ports you would like to open in specific container.

67
00:05:11,270 --> 00:05:18,440
And below in the port section you could specify a list of the container ports which will be open on

68
00:05:18,440 --> 00:05:20,150
the post IP address.

69
00:05:20,630 --> 00:05:30,080
So let's feel now the details in this spec section image will be vista slash k8s web.

70
00:05:30,080 --> 00:05:30,770
Hello.

71
00:05:31,550 --> 00:05:37,430
And the ports here will be container port 3000 like that.

72
00:05:37,820 --> 00:05:45,530
Also notice that via code Kubernetes extension added resources section here and in this section there

73
00:05:45,530 --> 00:05:54,620
was limits key which specify memory and CPU limits for each port which will be created by this deployment.

74
00:05:55,700 --> 00:06:00,570
And here we limit amount of memory and amount of CPU resources.

75
00:06:00,590 --> 00:06:04,550
500 MB means half of the CPU core.

76
00:06:04,850 --> 00:06:11,570
If you want, you could modify a 500 to 250, for example, one fourth of the CPU core.

77
00:06:11,600 --> 00:06:13,010
Let's keep it like that.

78
00:06:13,010 --> 00:06:16,880
And that's it for this specification of the deployment.

