WEBVTT

00:00.640 --> 00:01.760
We're all done with our Travis.

00:01.920 --> 00:03.760
YML file and our deployment script.

00:03.760 --> 00:08.680
But before we try to deploy this, there's 1 or 2 little last pieces of configuration we have to put

00:08.680 --> 00:10.440
together on Google Cloud.

00:10.800 --> 00:15.680
Now I'm on my dashboard right here, and I'm making sure that I've got my multi k8's project selected.

00:16.040 --> 00:20.560
Now let me give you a quick reminder of something that we did previously in our local environment that

00:20.560 --> 00:24.000
we have to manually do on Kubernetes, on the cloud as well.

00:24.600 --> 00:28.240
So one thing we had previously done was create a secret.

00:28.440 --> 00:34.000
We had created a secret to make sure that the multi server had a PG password environment variable.

00:34.520 --> 00:40.080
This environment variable of PG password was encoded into a Kubernetes secret and then shared with both

00:40.080 --> 00:43.960
the multi server and our, excuse me, our Postgres image as well.

00:44.360 --> 00:49.760
In fact, if you open up your code editor right now and find your K8's server deployment file at the

00:49.760 --> 00:54.920
very bottom, you'll recall that we had hooked up our secret to this thing with a name of PG password

00:54.920 --> 00:59.760
for the secret, and the secret contained a key of PG password as well.

01:01.120 --> 01:05.720
So we need to make sure that we set up an environment variable or a secret, just like this one on our

01:05.720 --> 01:08.320
remote Kubernetes instance as well.

01:08.560 --> 01:11.640
So this cluster does not currently have a secret assigned to it.

01:11.640 --> 01:18.760
For that pkg password, we have to manually create one by running that kubectl create secret command.

01:19.280 --> 01:22.920
Now this is one of the very few instances of a imperative command that we have to run.

01:22.960 --> 01:27.320
Remember, we did not create a config file for the secret, because that would kind of defeat the purpose

01:27.320 --> 01:29.040
of using a secret in the first place.

01:29.280 --> 01:29.840
The secret.

01:29.840 --> 01:33.960
We specifically do not want to put that thing in plain text inside of our repository.

01:34.760 --> 01:40.240
Okay, so all we have to do is essentially get access to a kubectl instance that is connected to the

01:40.240 --> 01:42.760
multi-cluster hosted on Google Cloud.

01:43.560 --> 01:48.920
Now, to do so, we do not have to reconfigure our local kubectl command or anything like that.

01:48.920 --> 01:52.120
So we're not going to reconfigure this command or anything.

01:52.160 --> 01:56.040
Instead, we're going to make use of a really awesome feature on Google Cloud.

01:56.400 --> 02:01.680
So up at the top right hand side of your dashboard, I want you to find this little Activate Cloud Shell

02:01.680 --> 02:02.600
button right here.

02:02.960 --> 02:09.200
If you click it, you'll then very quickly be connected to a terminal or a shell that is essentially

02:09.200 --> 02:12.800
running in the context of your Google Cloud project.

02:13.200 --> 02:18.330
So inside of here, we can issue any set of commands against all of our production resources.

02:18.610 --> 02:25.650
We can make use of kubectl and have this kubectl command apply to our multi-cluster that we just created.

02:26.010 --> 02:28.050
And so we get to run all the same commands.

02:28.050 --> 02:33.970
We had previously ran back on our local machine through this little terminal or the shell right here.

02:34.250 --> 02:39.210
This is really one of the features that makes Google Cloud a lot easier to use, and a lot easier to

02:39.210 --> 02:41.010
get started with than AWS.

02:41.330 --> 02:46.970
Now, to be honest, with AWS, you can set up something similar by reconfiguring your local shell on

02:46.970 --> 02:53.970
your computer, or you can SSH into one of your Kubernetes clusters that is hosted by AWS.

02:53.970 --> 02:58.810
But the entire process of that is way, way, way more complicated than just pressing the button up

02:58.810 --> 03:00.570
here and essentially being done with it.

03:01.370 --> 03:01.570
Okay.

03:01.610 --> 03:04.410
So we're going to run our kubectl create command right here.

03:04.410 --> 03:07.970
Before we do we need to do just a tiny little bit of configuration.

03:08.370 --> 03:14.570
So back inside of our YAML file remember how we installed the gcloud command right here at the Google

03:14.570 --> 03:15.330
Cloud SDK.

03:15.570 --> 03:21.290
And then we ran the series of commands right here to config and set our project and our compute zone,

03:21.290 --> 03:24.410
and then eventually get a set of credentials for Multi-cluster as well.

03:24.610 --> 03:27.850
We have to do the same thing on this shell over here as well.

03:27.850 --> 03:31.290
So we need to set our project ID, we need to set our compute zone.

03:31.290 --> 03:32.890
And we need to get those credentials too.

03:33.850 --> 03:37.770
So to do so I'm going to first zoom this in a little bit so you can see it more easily.

03:38.250 --> 03:43.170
We'll first run G cloud config set project.

03:43.530 --> 03:47.290
And then we'll get our project ID by going up to the project dropdown up here.

03:47.530 --> 03:49.290
And then finding the ID right here.

03:50.050 --> 03:54.090
So I'm going to copy that and I will paste it.

03:54.650 --> 03:55.290
Try it again.

03:55.810 --> 03:56.210
There we go.

03:56.250 --> 03:57.050
Paste it in.

03:57.330 --> 04:01.490
So gcloud config set project and then the id okay.

04:01.530 --> 04:02.250
So that looks good.

04:02.290 --> 04:04.690
Now the next thing we need to do is set our compute zone.

04:04.730 --> 04:09.250
Remember if you go to your Kubernetes Engine dashboard and you look at your cluster it'll print out

04:09.250 --> 04:10.530
the location right here.

04:10.810 --> 04:12.130
That is our compute zone.

04:12.770 --> 04:17.970
So I'll do gcloud config set compute zone.

04:18.890 --> 04:26.530
And then for me I'm going to use us Central1 a US central 1-A.

04:26.530 --> 04:26.660
A.

04:28.780 --> 04:29.060
Cool.

04:29.060 --> 04:29.620
That looks good.

04:29.660 --> 04:32.980
So now the last thing we need to do is that get credentials command.

04:33.300 --> 04:40.620
So gcloud container clusters get credentials.

04:41.380 --> 04:44.780
And then I'll put in the name of my cluster which is multi-cluster.

04:48.260 --> 04:48.500
Cool.

04:48.500 --> 04:49.620
So that's pretty much it.

04:49.660 --> 04:53.580
Now just so you know, you only have to run this series of commands right here one time, unless you

04:53.620 --> 04:58.420
create a different Kubernetes cluster at some point in the future, or a different project, every time

04:58.420 --> 05:02.460
you create a separate cluster or a different project, you're going to have to rerun that series of

05:02.460 --> 05:03.060
commands.

05:03.500 --> 05:05.700
So in general, for the rest of this course, we're going to be okay.

05:05.700 --> 05:10.060
But if you go off and start working on your own application at some point in the future with a new cluster,

05:10.060 --> 05:11.660
you're going to have to run those again.

05:11.660 --> 05:17.060
And as a very easy reference, you can just go back to the Travis file and reference these three commands

05:17.060 --> 05:19.100
right here so that you know what to run in the future.

05:20.540 --> 05:20.820
Okay.

05:20.860 --> 05:22.860
So that is going to configure gcloud.

05:22.860 --> 05:25.780
So we can now use kubectl safely inside the shell.

05:25.940 --> 05:26.860
Let's take a quick pause.

05:26.860 --> 05:31.940
When we come back in the next section we're going to use kubectl to create a secret tied to our cluster.

05:32.100 --> 05:33.580
So I'll see you in just a minute.
