-: In the last section
we started working on our Travis Dot YAML file.
We've now got some configuration that's going to
install the Google Cloud SDK.
It then is going to download
and install the Cube CTL command line tool.
And then finally, we had said that we need to make sure
that we essentially authorize the Google Cloud SDK
with some service account and the credentials
for that are going to be placed inside
of this service account J on file.
Now, this section we're going to create this service
account J on file.
We're gonna put some credentials in there
and then we're going to somehow hook it
up to our Travis CI built.
Now here's the entire series
of steps that we're going to go through.
So the first thing we have to do is log
onto our Google Cloud console
and we're going to create a service account.
Remember, a service account is very similar
to that IAM user that we had created back on AWS.
It's essentially a set
of credentials that's going to allow program addict access
to our Google Cloud account.
When we make that service account will then be provided
with a JSON file that contains the account
credentials to access the service account.
So that JSON file is a very sensitive little file
and we really want to make sure that the information inside
of it does not get exposed to the outside world.
So to make sure that we don't have to commit that file
to GitHub and accidentally push that to GitHub
or anything like that, we're going to encrypt the file
and store the encrypted file on Travis CI's servers.
Now we've already gone through an example where we made use
of a environment variable that was encrypted with Travis CI,
but that was with a string
or just a simple environment variable.
This time around, we want to load
up a file that gets encrypted
and sort with Travis as opposed to a simple string.
So to do so
we're going to download and install the Travis CLI.
Now the real name for this would be like the Travis CI CLI
but I realized that was kind of confusing.
So we're going to download Travis CLI on our local machine
and we'll be able to use that CLI to encrypt this file
and store it with Travis.
So we're going to encrypt it and then upload the JSON file
and tie it to our Travis account so that it
cannot be viewed as plain text by anyone else in the world.
Then finally, inside of our Travis dot EMO file
we're gonna add a little bit of configuration
to take that file that we just encrypted and uploaded.
We're going to unencrypted, unencrypted it JSON file
and then we're gonna take the JSON file and load
it into Google Cloud or the G cloud SDK.
And this is essentially the line right here
that's going to do that.
This line is what takes that JSON file and loads
it up and tells the Google Cloud SDK that Hey
here's who we are and here are the credentials
that you need to access our Kubernetes cluster.
Okay, so let's get to it.
Step one, create a service account.
So I'm going to go back over to my Google Cloud
dashboard on the top left hand side
I'll find my navigation menu
and then I'm gonna scroll down to IAM and admin right here.
Now on this page, you might already see a bunch
of different things created here.
I don't recall if these are, Nah, these are brand new.
I'm pretty sure these are brand new.
I was gonna say, I can't recall
if these are automatically generated or what
but I'm pretty sure these will automatically generate it.
Now on the left hand side, I'm gonna find service accounts.
Then on the top right hand side, I'll say, Oops
not that one.
Let me zoom out here.
I can't actually see everything
because I'm running a little zoomed in there.
There it is, create service account right in the middle.
Okay, so we're gonna put in some information to this thing.
First, we have to provide a account name.
You can put any name in here that you want.
It really doesn't matter.
It'd be nice
if you just kind of, as the note says, kind of
describe what this service account is going to be used for.
So I'll call this thing, How about Travis Deployer?
I think that makes enough sense.
We then have to assign a role, which is essentially
the permissions that this service account is going to have.
So in this table, I'm gonna scroll down and find Kubernetes.
So here's Kubernetes engine, and we're going to
make it an engine admin because this is going to
be a service account that has total control
over our cluster and can easily create new objects
delete objects, edit them, whatever needs to be done.
So I'll click on that
and then we'll select furnish a new private key
and we want to get a JSON file for our private key.
So that's pretty much it.
I'm then going to save the file, or excuse me
save the new service account.
And then I'll be automatically prompted
with a download here for the JSON file that has
our account credentials inside of it.
So I can close this window
and then this JSON file right here.
This is the very important thing that we want to make use
of and eventually encrypt and upload to Travis CI.
Now I want to be a hundred percent clear.
This is extremely important.
So please listen very carefully.
This file that was just downloaded under no way, shape
or form do I ever, ever, ever want to accidentally
expose this JSON file to the outside world.
So I'm gonna make a hundred percent sure
that I do not accidentally commit this file
to GI or upload it to GitHub or anything like that.
So again, please make sure
that you treat this file very carefully
and do not accidentally expose it to the outside world.
All right, so now that we've created our service account
let's take a quick pause right here.
When we come back in the next section
we're going to download and install the Travis CLI.
So quick pause and I'll see you in just a minute.