Now in order to practice deployment
on a real cluster out there on the real cloud provider
we need a demo project and therefore you find one attached.
It's kind of similar to the project
from the last course section, but a bit more polished.
And for the moment, at least also simplified.
At the moment we have QAPIs, the user's NT auth API.
And just like in the last course section,
the users API will communicate with the auth API
and the auth API should not be reachable from the public.
For that I got a docker-compose Yaml file
which would allow you to run this all locally
without Kubernetes, simply with Docker compose app.
And I also got a Kubernetes configuration here
where you find two Yaml files,
one for the auth API and one for the users API.
And in both Yaml files, you find both
a service and a deployment combined in one file.
I talked about the fact that you can combine
these configurations into one file earlier.
Here for the user's Yaml file,
you will notice that we have a service of
type load balancer, listening on port 80
on the outside world and redirecting traffic
to port 3000 internally, since that is the port
this application is listening on
and then here for the deployment,
you see I'm using a container with this image
and I have some environment variables.
And I'll come back to what you need to adjust
in these configuration files in a second.
For the auth Yaml file, we have a service which uses
or which is of type cluster IP,
which means it's only a way liable internally.
It listens on a port 3000
and we also have a deployment here
also with an environment variable and using a certain image.
Now, please note that for users Yaml,
I have an environment variable.
The auth IP address which actually uses this
automatically generated domain name
for the auth service here in the auth Yaml file,
so that we can send requests to this auth service
from inside the users image here and the users container.
And here we're really just using what you learned about
in the last course section.
So, make sure you go through that section first
before you continue with this one.
I'm also sending the request to port 3000.
So, I'm setting this as part of my address
because this auth service is listening on port 3000.
Now you can absolutely dive into
the source code if you want to.
It's a node JS application
which at the moment allows us to create and log in users.
And the auth API has a couple of utility functionalities
you could say, which allow us to hash passwords,
create tokens and verify tokens.
Again, the auth API will only be accessible
from inside the cluster.
So, that's the general setup we have here.
Now, we have a couple of environment variables here,
and of course certain image names.
And you will need to adjust that
in your Kubernedes Yaml files if you wanna follow along.
For the user's Yaml file, for example,
I am providing a MongoDB connection URI,
because we are connecting to MongoDB
in the user's app JS file.
We are connecting to that,
and for that you need a connection string,
hence you need a MongoDB Atlas cluster up and running
if you wanna follow along.
You can create and try that for free.
I showed this earlier in the course already,
but if you skipped these parts early in the course,
you can just try this for free here on mongodb.com.
fill in your details here,
and ultimately with that create a free account.
And once you're logged in,
you can create such a MongoDB cluster,
which has nothing to do with Kubernetes clusters.
MongoDB Atlas is simply a MongoDB managed service,
has nothing to do with Kuberneters.
It's just a database which I'm using here.
Create a cluster here and then once you got
your cluster created, use the connect button
and connect your application to get this connection string
which should be the connection string you use here
as a value for this environment variable.
You need to fill in your username and password
and database name values.
And whilst the database name is up to you,
for the username and the password
under a security database access,
you should add a new database user,
add a password and make sure you have
read and write access to any database,
and then use that username and that assigned password
here in your connection string.
So, replace my username and my password with your values.
And of course also add any database name of your choice
or go with users as I do it.
Now, the other adjustment we'll need to make
is the container image.
Here, I already built the images for the auth API
and the users API and pushed them to Docker hub.
You of course need to do that for yourself,
because these images will be deleted
when you're viewing this.
So, here on Docker hub, I simply created two repositories
to kub-depu-sers and kub-dep-auth repository.
And then I built my images
by giving these images the respective tags,
and then I pushed these images to Docker hub.
So, I built one image for the user's API folder by
simply navigating into it, running Docker build
using my name here like this.
And then once this was built, of course,
I executed Docker push with that name,
kub-dep-users.
And this would then push the image
with all the changes to Docker hub.
And you need to do that for both users API and auth API.
These are all things we did multiple times
throughout the last course sections.
Now, once you did that, once you made sure
you're using your database URL
and you're using your image names,
of course, in both Yaml files,
the database is not getting used here, in auth Yaml,
but you should bring your own image here.
Once you did all of that,
you got your Kubernetes configuration prepared,
you got this project prepared
and now it's time where we can move on
and finally start setting up our AWS EKS cluster
so that we can deploy it there.
You can, of course, if you want to,
first of all also apply this configuration
on your local mini cube cluster
and play around with it there,
but I'm not going to do this here
because we did it multiple times
over the last core sections.
Instead, I will now dive into AWS
and get started with AWS EKS.