WEBVTT

00:01.080 --> 00:03.000
-: In this video, there's a couple odds and ends

00:03.000 --> 00:04.830
I want to mention around Skaffold.

00:04.830 --> 00:05.940
So you'll notice that down here

00:05.940 --> 00:07.629
at the very bottom of the config file,

00:07.629 --> 00:10.320
we added in this manifest section

00:10.320 --> 00:11.460
and we provided a path

00:11.460 --> 00:14.370
to just that client deployment yaml file.

00:14.370 --> 00:16.230
So by adding in this yaml file right here,

00:16.230 --> 00:17.460
anytime we start up Skaffold

00:17.460 --> 00:19.371
with Skaffold Dev at our terminal,

00:19.371 --> 00:21.090
Skaffold will automatically

00:21.090 --> 00:23.101
try to apply that yaml config file

00:23.101 --> 00:25.370
to our Kubernetes cluster.

00:25.370 --> 00:27.210
Now here's the important part.

00:27.210 --> 00:29.069
Anytime we close down Skaffold,

00:29.069 --> 00:32.550
Skaffold will immediately try to delete the deployment

00:32.550 --> 00:35.490
that we created with that file as well.

00:35.490 --> 00:36.330
So take a look at this.

00:36.330 --> 00:39.300
If I flip back over to my browser or see my terminal,

00:39.300 --> 00:40.773
and I hit control+C,

00:42.570 --> 00:43.680
we're going to automatically

00:43.680 --> 00:47.370
see deployment apps client deployment deleted right here.

00:47.370 --> 00:50.670
If I now attempt to get my pods,

00:50.670 --> 00:52.290
I'll see that all of my client pods

00:52.290 --> 00:53.941
have been deleted automatically.

00:53.941 --> 00:55.980
So this is another feature of Skaffold

00:55.980 --> 00:57.720
that's really nice.

00:57.720 --> 01:00.720
Right now, anytime you do some local Kubernetes development,

01:00.720 --> 01:03.240
if you decide to pause working on one project

01:03.240 --> 01:04.770
and start working on another,

01:04.770 --> 01:07.491
you might have a ton of different containers or pods

01:07.491 --> 01:09.540
in the same name space

01:09.540 --> 01:11.880
and it's kind of hard to tell which is which.

01:11.880 --> 01:13.140
So by using Skaffold,

01:13.140 --> 01:14.370
you can automatically set

01:14.370 --> 01:16.980
startup one set of different pods

01:16.980 --> 01:18.870
and then automatically close them all down

01:18.870 --> 01:21.123
as soon as you stop Skaffold as well.

01:22.410 --> 01:23.243
At present,

01:23.243 --> 01:26.070
we are not having our server deployment being managed

01:26.070 --> 01:29.040
or our worker deployment being managed by Skaffold.

01:29.040 --> 01:30.120
So if you wanted to make sure

01:30.120 --> 01:31.740
that those pods also started up

01:31.740 --> 01:33.480
and got shut down automatically,

01:33.480 --> 01:36.030
we could add them to that manifest section.

01:36.030 --> 01:37.230
Let's do that right now.

01:38.430 --> 01:40.630
So back over here, I can add in K8s

01:42.690 --> 01:45.040
and we're going to go for our server deployment

01:48.480 --> 01:53.193
and we can also do our K8s worker deployment as well.

01:56.280 --> 01:57.300
You're not limited just

01:57.300 --> 02:00.300
to having deployments being managed by Skaffold.

02:00.300 --> 02:02.280
We can also add in services as well.

02:02.280 --> 02:04.320
So if we wanted to make sure that we also, say,

02:04.320 --> 02:06.540
shut down the server cluster IP service,

02:06.540 --> 02:08.580
we can just add that as an additional entry.

02:08.580 --> 02:13.580
So I can do server cluster IP service .yaml, like so.

02:14.430 --> 02:15.750
And the same thing for,

02:15.750 --> 02:18.120
let's just go ahead and be complete here,

02:18.120 --> 02:21.531
I'll add in also my client cluster IP service

02:21.531 --> 02:24.600
and our worker doesn't have one

02:24.600 --> 02:27.153
so we'll just do just server and client.

02:28.110 --> 02:29.651
All right, so I can now save this file,

02:29.651 --> 02:31.438
flip back over to my terminal.

02:31.438 --> 02:34.773
I can start everything up with a Skaffold Dev.

02:37.320 --> 02:39.150
So we'll see that Skaffold

02:39.150 --> 02:42.570
has automatically applied all those different config files.

02:42.570 --> 02:44.520
Our React application's gonna start up,

02:46.920 --> 02:48.120
and then at any point in time,

02:48.120 --> 02:49.500
we can hit control+C

02:49.500 --> 02:51.120
and we'll see that Skaffold's gonna shut down

02:51.120 --> 02:52.650
all of our client pods,

02:52.650 --> 02:55.230
all the server pods, and the worker pod as well.

02:55.230 --> 02:56.070
So I'll do that right now.

02:56.070 --> 02:57.720
I'll hit control+C,

02:57.720 --> 03:00.090
that's going to delete all those pods.

03:00.090 --> 03:03.316
And now if I get my pods, yep,

03:03.316 --> 03:05.400
I will see that the server deployment,

03:05.400 --> 03:06.690
while it's still listed,

03:06.690 --> 03:09.330
it is being terminated along with the worker as well.

03:09.330 --> 03:11.490
So if I run that again right now, yeah, there we go.

03:11.490 --> 03:14.040
Now the server and the workers are completely gone.

03:15.090 --> 03:15.923
Now there is, kind of,

03:15.923 --> 03:18.425
one downside to this entire approach of adding in

03:18.425 --> 03:22.530
all these different services or manifests

03:22.530 --> 03:24.780
into this Skaffold file right here.

03:24.780 --> 03:25.950
'Cause remember we're now saying

03:25.950 --> 03:28.500
that as soon as we close down Skaffold,

03:28.500 --> 03:29.940
we're going to essentially delete

03:29.940 --> 03:31.740
all the things we have listed here.

03:31.740 --> 03:32.700
So the downside to that

03:32.700 --> 03:35.160
is that if you have anything persistent,

03:35.160 --> 03:37.830
like maybe a database or a volume

03:37.830 --> 03:40.620
that you want to keep around for development purposes

03:40.620 --> 03:42.810
because maybe you've got a lot of test data loaded on there

03:42.810 --> 03:44.040
or something like that,

03:44.040 --> 03:47.160
do not add those things into your Skaffold file

03:47.160 --> 03:48.996
because if you have any persistent data

03:48.996 --> 03:52.200
in the form of volumes or pods or whatever else,

03:52.200 --> 03:53.940
Skaffold is gonna delete that stuff

03:53.940 --> 03:55.683
as soon as you close it down.

03:56.790 --> 03:57.690
So I would recommend

03:57.690 --> 04:00.360
not adding those things to your Skaffold file.

04:00.360 --> 04:04.230
And you can actually see in my environment right here,

04:04.230 --> 04:06.330
I actually have a Postgres deployment

04:06.330 --> 04:08.820
that's been running for 110 days.

04:08.820 --> 04:10.830
So that's for a very different project

04:10.830 --> 04:12.780
that I've been working on for quite a while.

04:12.780 --> 04:14.790
I don't want that deployment for Postgres

04:14.790 --> 04:16.530
to be managed by Skaffold

04:16.530 --> 04:18.750
'cause I have some persistent test data in there

04:18.750 --> 04:22.770
and I don't want to have to be recreating that database

04:22.770 --> 04:25.230
and reseeding that database with all that test data

04:25.230 --> 04:27.030
every single time I decide to go back

04:27.030 --> 04:29.280
and start using Skaffold on it again.

04:29.280 --> 04:31.170
So in the case of all your different pods

04:31.170 --> 04:33.930
for running React applications or APIs

04:33.930 --> 04:35.610
or, kind of, these stateless services,

04:35.610 --> 04:37.980
no problem adding them to the Skaffold file.

04:37.980 --> 04:39.870
But if for anything related to data,

04:39.870 --> 04:41.370
you might not want to add it in

04:41.370 --> 04:42.210
because, like I said,

04:42.210 --> 04:44.763
Skaffold is just going to very quickly delete it.

04:45.960 --> 04:46.793
All right,

04:46.793 --> 04:49.620
so now that we understand a lot more about Skaffold,

04:49.620 --> 04:52.350
I wanna add in all of our different services or deployments

04:52.350 --> 04:54.450
to this thing so that we can get some live updates

04:54.450 --> 04:56.370
on our server, and our worker,

04:56.370 --> 04:57.960
and all that good stuff as well.

04:57.960 --> 04:59.280
So let's take a quick pause.

04:59.280 --> 05:00.150
When we come back,

05:00.150 --> 05:01.920
we'll just add in some more configuration

05:01.920 --> 05:04.950
for artifacts for both the worker and the server.

05:04.950 --> 05:06.600
So I'll see you in just a minute.
