1
00:00:02,180 --> 00:00:05,500
Now in order to practice deployment

2
00:00:05,500 --> 00:00:09,860
on a real cluster out there on the real cloud provider

3
00:00:09,860 --> 00:00:14,320
we need a demo project and therefore you find one attached.

4
00:00:14,320 --> 00:00:16,329
It's kind of similar to the project

5
00:00:16,329 --> 00:00:20,470
from the last course section, but a bit more polished.

6
00:00:20,470 --> 00:00:24,150
And for the moment, at least also simplified.

7
00:00:24,150 --> 00:00:28,680
At the moment we have QAPIs, the user's NT auth API.

8
00:00:28,680 --> 00:00:31,560
And just like in the last course section,

9
00:00:31,560 --> 00:00:35,630
the users API will communicate with the auth API

10
00:00:35,630 --> 00:00:39,363
and the auth API should not be reachable from the public.

11
00:00:40,440 --> 00:00:43,110
For that I got a docker-compose Yaml file

12
00:00:43,110 --> 00:00:46,100
which would allow you to run this all locally

13
00:00:46,100 --> 00:00:50,790
without Kubernetes, simply with Docker compose app.

14
00:00:50,790 --> 00:00:54,500
And I also got a Kubernetes configuration here

15
00:00:54,500 --> 00:00:57,210
where you find two Yaml files,

16
00:00:57,210 --> 00:01:01,130
one for the auth API and one for the users API.

17
00:01:01,130 --> 00:01:04,099
And in both Yaml files, you find both

18
00:01:04,099 --> 00:01:08,560
a service and a deployment combined in one file.

19
00:01:08,560 --> 00:01:11,160
I talked about the fact that you can combine

20
00:01:11,160 --> 00:01:14,520
these configurations into one file earlier.

21
00:01:14,520 --> 00:01:16,870
Here for the user's Yaml file,

22
00:01:16,870 --> 00:01:18,750
you will notice that we have a service of

23
00:01:18,750 --> 00:01:21,790
type load balancer, listening on port 80

24
00:01:21,790 --> 00:01:24,450
on the outside world and redirecting traffic

25
00:01:24,450 --> 00:01:28,980
to port 3000 internally, since that is the port

26
00:01:28,980 --> 00:01:31,320
this application is listening on

27
00:01:33,460 --> 00:01:36,900
and then here for the deployment,

28
00:01:36,900 --> 00:01:40,010
you see I'm using a container with this image

29
00:01:40,010 --> 00:01:42,790
and I have some environment variables.

30
00:01:42,790 --> 00:01:45,240
And I'll come back to what you need to adjust

31
00:01:45,240 --> 00:01:48,470
in these configuration files in a second.

32
00:01:48,470 --> 00:01:52,740
For the auth Yaml file, we have a service which uses

33
00:01:52,740 --> 00:01:54,770
or which is of type cluster IP,

34
00:01:54,770 --> 00:01:58,310
which means it's only a way liable internally.

35
00:01:58,310 --> 00:02:00,930
It listens on a port 3000

36
00:02:00,930 --> 00:02:03,160
and we also have a deployment here

37
00:02:03,160 --> 00:02:06,943
also with an environment variable and using a certain image.

38
00:02:07,810 --> 00:02:10,530
Now, please note that for users Yaml,

39
00:02:10,530 --> 00:02:12,570
I have an environment variable.

40
00:02:12,570 --> 00:02:16,310
The auth IP address which actually uses this

41
00:02:16,310 --> 00:02:19,090
automatically generated domain name

42
00:02:19,090 --> 00:02:23,200
for the auth service here in the auth Yaml file,

43
00:02:23,200 --> 00:02:26,990
so that we can send requests to this auth service

44
00:02:26,990 --> 00:02:31,990
from inside the users image here and the users container.

45
00:02:32,320 --> 00:02:35,360
And here we're really just using what you learned about

46
00:02:35,360 --> 00:02:37,250
in the last course section.

47
00:02:37,250 --> 00:02:39,860
So, make sure you go through that section first

48
00:02:39,860 --> 00:02:42,610
before you continue with this one.

49
00:02:42,610 --> 00:02:46,150
I'm also sending the request to port 3000.

50
00:02:46,150 --> 00:02:48,380
So, I'm setting this as part of my address

51
00:02:48,380 --> 00:02:52,793
because this auth service is listening on port 3000.

52
00:02:53,870 --> 00:02:55,630
Now you can absolutely dive into

53
00:02:55,630 --> 00:02:57,600
the source code if you want to.

54
00:02:57,600 --> 00:02:59,780
It's a node JS application

55
00:02:59,780 --> 00:03:03,420
which at the moment allows us to create and log in users.

56
00:03:03,420 --> 00:03:07,740
And the auth API has a couple of utility functionalities

57
00:03:07,740 --> 00:03:11,300
you could say, which allow us to hash passwords,

58
00:03:11,300 --> 00:03:14,623
create tokens and verify tokens.

59
00:03:15,650 --> 00:03:18,770
Again, the auth API will only be accessible

60
00:03:18,770 --> 00:03:21,000
from inside the cluster.

61
00:03:21,000 --> 00:03:23,680
So, that's the general setup we have here.

62
00:03:23,680 --> 00:03:26,800
Now, we have a couple of environment variables here,

63
00:03:26,800 --> 00:03:29,250
and of course certain image names.

64
00:03:29,250 --> 00:03:31,320
And you will need to adjust that

65
00:03:31,320 --> 00:03:35,590
in your Kubernedes Yaml files if you wanna follow along.

66
00:03:35,590 --> 00:03:38,090
For the user's Yaml file, for example,

67
00:03:38,090 --> 00:03:41,023
I am providing a MongoDB connection URI,

68
00:03:41,880 --> 00:03:44,490
because we are connecting to MongoDB

69
00:03:44,490 --> 00:03:47,310
in the user's app JS file.

70
00:03:47,310 --> 00:03:48,750
We are connecting to that,

71
00:03:48,750 --> 00:03:51,370
and for that you need a connection string,

72
00:03:51,370 --> 00:03:54,670
hence you need a MongoDB Atlas cluster up and running

73
00:03:54,670 --> 00:03:56,980
if you wanna follow along.

74
00:03:56,980 --> 00:03:59,930
You can create and try that for free.

75
00:03:59,930 --> 00:04:02,860
I showed this earlier in the course already,

76
00:04:02,860 --> 00:04:05,890
but if you skipped these parts early in the course,

77
00:04:05,890 --> 00:04:09,880
you can just try this for free here on mongodb.com.

78
00:04:09,880 --> 00:04:11,740
fill in your details here,

79
00:04:11,740 --> 00:04:15,480
and ultimately with that create a free account.

80
00:04:15,480 --> 00:04:16,769
And once you're logged in,

81
00:04:16,769 --> 00:04:19,250
you can create such a MongoDB cluster,

82
00:04:19,250 --> 00:04:22,350
which has nothing to do with Kubernetes clusters.

83
00:04:22,350 --> 00:04:25,830
MongoDB Atlas is simply a MongoDB managed service,

84
00:04:25,830 --> 00:04:27,740
has nothing to do with Kuberneters.

85
00:04:27,740 --> 00:04:30,510
It's just a database which I'm using here.

86
00:04:30,510 --> 00:04:33,280
Create a cluster here and then once you got

87
00:04:33,280 --> 00:04:36,350
your cluster created, use the connect button

88
00:04:36,350 --> 00:04:40,230
and connect your application to get this connection string

89
00:04:40,230 --> 00:04:42,850
which should be the connection string you use here

90
00:04:42,850 --> 00:04:45,883
as a value for this environment variable.

91
00:04:47,040 --> 00:04:50,600
You need to fill in your username and password

92
00:04:50,600 --> 00:04:53,320
and database name values.

93
00:04:53,320 --> 00:04:55,780
And whilst the database name is up to you,

94
00:04:55,780 --> 00:04:58,720
for the username and the password

95
00:04:58,720 --> 00:05:01,230
under a security database access,

96
00:05:01,230 --> 00:05:03,820
you should add a new database user,

97
00:05:03,820 --> 00:05:06,350
add a password and make sure you have

98
00:05:06,350 --> 00:05:09,200
read and write access to any database,

99
00:05:09,200 --> 00:05:13,300
and then use that username and that assigned password

100
00:05:13,300 --> 00:05:15,573
here in your connection string.

101
00:05:16,630 --> 00:05:21,630
So, replace my username and my password with your values.

102
00:05:21,980 --> 00:05:25,690
And of course also add any database name of your choice

103
00:05:25,690 --> 00:05:28,263
or go with users as I do it.

104
00:05:29,750 --> 00:05:32,130
Now, the other adjustment we'll need to make

105
00:05:32,130 --> 00:05:34,590
is the container image.

106
00:05:34,590 --> 00:05:38,630
Here, I already built the images for the auth API

107
00:05:38,630 --> 00:05:42,150
and the users API and pushed them to Docker hub.

108
00:05:42,150 --> 00:05:45,110
You of course need to do that for yourself,

109
00:05:45,110 --> 00:05:47,000
because these images will be deleted

110
00:05:47,000 --> 00:05:49,070
when you're viewing this.

111
00:05:49,070 --> 00:05:52,990
So, here on Docker hub, I simply created two repositories

112
00:05:52,990 --> 00:05:57,050
to kub-depu-sers and kub-dep-auth repository.

113
00:05:57,050 --> 00:05:59,550
And then I built my images

114
00:05:59,550 --> 00:06:02,720
by giving these images the respective tags,

115
00:06:02,720 --> 00:06:06,690
and then I pushed these images to Docker hub.

116
00:06:06,690 --> 00:06:11,180
So, I built one image for the user's API folder by

117
00:06:11,180 --> 00:06:15,500
simply navigating into it, running Docker build

118
00:06:15,500 --> 00:06:20,150
using my name here like this.

119
00:06:20,150 --> 00:06:23,310
And then once this was built, of course,

120
00:06:23,310 --> 00:06:26,613
I executed Docker push with that name,

121
00:06:28,320 --> 00:06:30,490
kub-dep-users.

122
00:06:30,490 --> 00:06:32,290
And this would then push the image

123
00:06:32,290 --> 00:06:34,850
with all the changes to Docker hub.

124
00:06:34,850 --> 00:06:38,693
And you need to do that for both users API and auth API.

125
00:06:39,530 --> 00:06:42,240
These are all things we did multiple times

126
00:06:42,240 --> 00:06:44,563
throughout the last course sections.

127
00:06:45,700 --> 00:06:48,370
Now, once you did that, once you made sure

128
00:06:48,370 --> 00:06:50,570
you're using your database URL

129
00:06:50,570 --> 00:06:53,280
and you're using your image names,

130
00:06:53,280 --> 00:06:55,640
of course, in both Yaml files,

131
00:06:55,640 --> 00:06:58,740
the database is not getting used here, in auth Yaml,

132
00:06:58,740 --> 00:07:00,810
but you should bring your own image here.

133
00:07:00,810 --> 00:07:02,420
Once you did all of that,

134
00:07:02,420 --> 00:07:05,500
you got your Kubernetes configuration prepared,

135
00:07:05,500 --> 00:07:07,300
you got this project prepared

136
00:07:07,300 --> 00:07:10,000
and now it's time where we can move on

137
00:07:10,000 --> 00:07:14,940
and finally start setting up our AWS EKS cluster

138
00:07:14,940 --> 00:07:16,763
so that we can deploy it there.

139
00:07:17,690 --> 00:07:19,840
You can, of course, if you want to,

140
00:07:19,840 --> 00:07:22,830
first of all also apply this configuration

141
00:07:22,830 --> 00:07:25,090
on your local mini cube cluster

142
00:07:25,090 --> 00:07:26,890
and play around with it there,

143
00:07:26,890 --> 00:07:28,660
but I'm not going to do this here

144
00:07:28,660 --> 00:07:30,210
because we did it multiple times

145
00:07:30,210 --> 00:07:31,830
over the last core sections.

146
00:07:31,830 --> 00:07:35,220
Instead, I will now dive into AWS

147
00:07:35,220 --> 00:07:37,313
and get started with AWS EKS.

