1
00:00:02,100 --> 00:00:03,950
Let's start with a command.

2
00:00:03,950 --> 00:00:07,080
Let's apply our two yaml files

3
00:00:07,080 --> 00:00:11,010
because that is the big idea behind Kubernetes.

4
00:00:11,010 --> 00:00:13,730
That we just need to create a cluster

5
00:00:13,730 --> 00:00:17,250
which of course can involve a couple of steps as you saw,

6
00:00:17,250 --> 00:00:18,880
but it wasn't too difficult,

7
00:00:18,880 --> 00:00:20,100
I would argue.

8
00:00:20,100 --> 00:00:22,420
But then once we got that cluster,

9
00:00:22,420 --> 00:00:24,540
we can use the configuration

10
00:00:24,540 --> 00:00:27,200
which we used before with MiniKube

11
00:00:27,200 --> 00:00:31,840
and take it as it is and apply it to that cluster.

12
00:00:31,840 --> 00:00:36,400
We don't need to add any AWS-specific instructions here

13
00:00:36,400 --> 00:00:37,780
for this deployment.

14
00:00:37,780 --> 00:00:39,670
We don't need to do anything else.

15
00:00:39,670 --> 00:00:42,410
We just wanna apply these yaml files

16
00:00:42,410 --> 00:00:45,900
and then hopefully have our running application

17
00:00:45,900 --> 00:00:47,787
up and running on AWS.

18
00:00:49,700 --> 00:00:51,870
So let's do that here.

19
00:00:51,870 --> 00:00:56,870
For this, I will cd into the Kubernetes folder,

20
00:00:56,920 --> 00:00:58,710
which holds my yaml files,

21
00:00:58,710 --> 00:01:01,050
and then run kube ctrl,

22
00:01:01,050 --> 00:01:03,550
which is connected to the AWS cluster

23
00:01:03,550 --> 00:01:05,150
as you learned before,

24
00:01:05,150 --> 00:01:10,150
apply dash f=auth.yaml and then again, f=users.yaml.

25
00:01:13,350 --> 00:01:18,073
Applying these two yaml files to our AWS cluster.

26
00:01:19,190 --> 00:01:23,630
And if we hit enter here, this should finish successfully

27
00:01:23,630 --> 00:01:27,420
and create these deployments and services.

28
00:01:27,420 --> 00:01:29,830
And therefore we can run get deployments

29
00:01:30,870 --> 00:01:33,130
to see our deployments here.

30
00:01:33,130 --> 00:01:36,560
Of course, by the way, make sure you pushed your images.

31
00:01:36,560 --> 00:01:40,030
If you didn't push your images as instructed earlier,

32
00:01:40,030 --> 00:01:41,490
this will not work,

33
00:01:41,490 --> 00:01:43,250
but if you pushed your images,

34
00:01:43,250 --> 00:01:46,050
you will eventually see that both deployments

35
00:01:46,050 --> 00:01:47,233
are up and running.

36
00:01:48,660 --> 00:01:52,170
We can also get our pods, of course, and see these pods.

37
00:01:52,170 --> 00:01:54,563
And we can also get our services.

38
00:01:55,610 --> 00:01:59,250
And if we do that, we'll also notice something interesting

39
00:01:59,250 --> 00:02:01,950
about the load balancer service.

40
00:02:01,950 --> 00:02:06,950
With MiniKube, the external IP field was always pending

41
00:02:07,980 --> 00:02:11,370
and we had to run MiniKube service

42
00:02:11,370 --> 00:02:14,690
to really expose that load balancer service

43
00:02:14,690 --> 00:02:16,770
to the outside world.

44
00:02:16,770 --> 00:02:19,670
Well, that was something MiniKube specific

45
00:02:19,670 --> 00:02:23,750
because it was that local virtual machine dummy set up.

46
00:02:23,750 --> 00:02:26,010
With AWS, it's different.

47
00:02:26,010 --> 00:02:28,540
We get a URL here,

48
00:02:28,540 --> 00:02:31,623
which we can simply use to send requests to.

49
00:02:32,830 --> 00:02:35,300
Now, this is our users service and we can,

50
00:02:35,300 --> 00:02:37,543
for example, use this in Postman.

51
00:02:39,100 --> 00:02:44,100
Simply open Postman and send a new post request to that URL

52
00:02:46,560 --> 00:02:48,873
which you got here from get services,

53
00:02:50,810 --> 00:02:53,790
slash sign up.

54
00:02:53,790 --> 00:02:58,790
And then go to Body, Raw and select CHSN,

55
00:02:59,500 --> 00:03:02,300
add curly braces, opening and closing

56
00:03:02,300 --> 00:03:05,360
and add an email field between double quotes,

57
00:03:05,360 --> 00:03:08,520
maybe with test@test.com

58
00:03:08,520 --> 00:03:11,270
and a password field between double quotes

59
00:03:11,270 --> 00:03:13,193
with a value of testers.

60
00:03:14,630 --> 00:03:16,933
It should be at least seven characters long.

61
00:03:17,780 --> 00:03:19,363
Then click Send.

62
00:03:20,250 --> 00:03:23,823
And you should get back a user-created response.

63
00:03:24,810 --> 00:03:27,280
If you now try to create that same user again,

64
00:03:27,280 --> 00:03:28,370
you'll get an error

65
00:03:28,370 --> 00:03:30,280
because it already exists.

66
00:03:30,280 --> 00:03:33,360
If you omit the @ in the email address,

67
00:03:33,360 --> 00:03:37,540
you get an error that the email or password is invalid.

68
00:03:37,540 --> 00:03:40,900
And if you create another user with a new email address

69
00:03:40,900 --> 00:03:43,683
which wasn't used before, it'll work again.

70
00:03:45,240 --> 00:03:48,250
We can also create another post request

71
00:03:48,250 --> 00:03:51,850
to that same URL slash login

72
00:03:51,850 --> 00:03:55,350
and add a body which is Raw, CHSN

73
00:03:55,350 --> 00:03:58,810
and then also contains an email and a password,

74
00:03:58,810 --> 00:04:01,603
maybe the email and password we used before.

75
00:04:03,930 --> 00:04:06,410
And if we send this post request,

76
00:04:06,410 --> 00:04:09,680
we should get back a response with a token.

77
00:04:09,680 --> 00:04:12,530
If we send it with an invalid password,

78
00:04:12,530 --> 00:04:14,253
we get back an error.

79
00:04:15,120 --> 00:04:18,750
And this all proves that our application is running

80
00:04:18,750 --> 00:04:21,290
because we are sending these requests

81
00:04:21,290 --> 00:04:24,190
to our AWS cluster here.

82
00:04:24,190 --> 00:04:28,920
And that is our application deployed with Kubernetes.

83
00:04:28,920 --> 00:04:30,330
And you can hopefully see

84
00:04:30,330 --> 00:04:32,700
the big advantage of Kubernetes here.

85
00:04:32,700 --> 00:04:34,700
The same configuration,

86
00:04:34,700 --> 00:04:37,320
which we worked with over the last sections

87
00:04:37,320 --> 00:04:39,570
and which would work MiniKube,

88
00:04:39,570 --> 00:04:41,807
works just like this with AWS.

89
00:04:43,400 --> 00:04:47,730
I also wanna show you that in the AWS console,

90
00:04:47,730 --> 00:04:50,860
if you go to the EC2 console again,

91
00:04:50,860 --> 00:04:53,050
you will see that on load balancers,

92
00:04:53,050 --> 00:04:55,170
we now got one load balancer

93
00:04:55,170 --> 00:04:58,730
which was created automatically by AWS

94
00:04:58,730 --> 00:05:02,670
because we deployed this load balancer service.

95
00:05:02,670 --> 00:05:04,657
And here you got this URL,

96
00:05:05,796 --> 00:05:10,097
which you also see if you run get services, this one.

97
00:05:11,100 --> 00:05:13,580
And that's the great thing about Kubernetes

98
00:05:13,580 --> 00:05:15,870
especially when using it together with

99
00:05:15,870 --> 00:05:18,950
managed services like EKS.

100
00:05:18,950 --> 00:05:23,400
It was super simple to deploy this basic application

101
00:05:23,400 --> 00:05:27,440
and we didn't have to learn many new things.

102
00:05:27,440 --> 00:05:29,350
Yes, we had a couple of setup steps

103
00:05:29,350 --> 00:05:31,430
to bring that cluster to life,

104
00:05:31,430 --> 00:05:35,060
but I would argue that was not too difficult.

105
00:05:35,060 --> 00:05:36,920
And then we just apply what we learned

106
00:05:36,920 --> 00:05:38,520
over the last sections

107
00:05:38,520 --> 00:05:42,650
and we have our successfully running Kubernetes application.

108
00:05:42,650 --> 00:05:44,140
And we can now manage it

109
00:05:44,140 --> 00:05:47,120
just as you learned it over the last sections.

110
00:05:47,120 --> 00:05:50,230
If you make a change to one of these yaml files,

111
00:05:50,230 --> 00:05:52,710
you can simply kubectrl apply it

112
00:05:52,710 --> 00:05:55,460
and your deployment will be updated.

113
00:05:55,460 --> 00:05:59,120
For example, if I go to my user's yaml file

114
00:05:59,120 --> 00:06:01,703
and I change my replicas to free there,

115
00:06:02,780 --> 00:06:07,440
I can apply the updated users.yaml file.

116
00:06:07,440 --> 00:06:12,220
And if I do that and I run kubectrl get pods thereafter,

117
00:06:12,220 --> 00:06:14,520
you now see we got more pods up and running

118
00:06:14,520 --> 00:06:17,530
and there are new pods getting started now.

119
00:06:17,530 --> 00:06:21,580
As a side note, pods are not nodes, as you learned.

120
00:06:21,580 --> 00:06:24,150
Pods are to things which contain containers

121
00:06:24,150 --> 00:06:26,220
which run on your nodes.

122
00:06:26,220 --> 00:06:29,360
And they will be distributed by Kubernetes

123
00:06:29,360 --> 00:06:31,410
across the available nodes

124
00:06:31,410 --> 00:06:34,710
of which, in our case we have two.

125
00:06:34,710 --> 00:06:37,810
So pods are distributed across the nodes.

126
00:06:37,810 --> 00:06:40,780
Nodes are not started with replicas.

127
00:06:40,780 --> 00:06:43,990
Nodes and the number of nodes are configured

128
00:06:43,990 --> 00:06:45,810
in your cluster here

129
00:06:45,810 --> 00:06:49,223
in the case of EKS with these node groups.

130
00:06:50,390 --> 00:06:53,490
And that's our deployed Kubernetes service.

131
00:06:53,490 --> 00:06:58,070
Please also note that this cluster internal communication

132
00:06:58,070 --> 00:07:00,890
with that automatically generated domain name

133
00:07:00,890 --> 00:07:02,370
works just fine.

134
00:07:02,370 --> 00:07:04,470
We didn't have to change anything here.

135
00:07:04,470 --> 00:07:07,360
I'm just using the service name dot default

136
00:07:07,360 --> 00:07:10,170
because we have that default namespace here

137
00:07:10,170 --> 00:07:14,120
in the Kubernetes cluster created by EKS as well.

138
00:07:14,120 --> 00:07:17,430
You can run kubectrl get namespaces

139
00:07:17,430 --> 00:07:19,580
to see the available namespaces.

140
00:07:19,580 --> 00:07:22,560
And here, you see that default namespace,

141
00:07:22,560 --> 00:07:24,553
which we are utilizing here.

142
00:07:25,400 --> 00:07:27,720
So this internal communication

143
00:07:27,720 --> 00:07:31,230
with this service of type ClusterIP

144
00:07:31,230 --> 00:07:34,120
and this automatically generated domain name,

145
00:07:34,120 --> 00:07:36,170
again, just works.

146
00:07:36,170 --> 00:07:39,710
It all just works as it did with MiniKube.

147
00:07:39,710 --> 00:07:40,790
And it should

148
00:07:40,790 --> 00:07:43,920
because that is the core philosophy behind Kubernetes

149
00:07:43,920 --> 00:07:44,753
in the end,

150
00:07:44,753 --> 00:07:47,380
that we have a standardized configuration

151
00:07:47,380 --> 00:07:50,380
which we can apply to any Kubernetes cluster

152
00:07:50,380 --> 00:07:54,603
to bring our Kubernetes-managed application to live there.

