Hey, everyone.
And welcome back.
Now, in today's video will be deploying the x cluster from scratch.
Now, before we go ahead and do that, one important thing that needs to be noted is that X is not part
of the free tier.
So if we'll just quickly look into the containers, you have the X, you have the X anyway if you go
ahead and search for x.
Or you can say Google.
It is it's not available here.
All right.
So this is one important thing to note.
So if you're going ahead and deploying the X, you will be charged.
You can either do it or you can just go through the video so that your concepts are better understood.
So currently from the console, let's quickly go to the X service and within here you can go ahead and
create a cluster.
You can also go to clusters and you can create a cluster from here.
The first important part is you have to name the cluster.
Let me just call it as demo case cluster.
The second important part is the Kubernetes versions.
There are multiple versions that are available.
As of now, it is 1.23.
If you try it out later, the version would be 1.24 or 1.25, etc..
The second important part here is the cluster service rule.
Now, as we are discussing in our case, practical steps that you have to provide an IAM rule to the
X so that X can go ahead and manage various services like CMS, EC, two LP and others.
So before you create a cluster, the cluster service rule must be present.
So let's go ahead and quickly do that.
I'll open up the IAM console.
So as of now they have also provided link to the X documentation that will show you how to create a
cluster rule in case if they remove this at a later stage, there is nothing much to worry because we'll
be looking into it at this stage.
So let's quickly go to the roles here and if you look into the documentation, it's very simple.
You go ahead and create a role.
Now within here, let's go ahead and quickly create a role.
The role type would be for the service of X.
So let's open this.
I'll select the X over here.
And in the use case here, you can select the x cluster.
So this is very similar to the documentation where within the use case you just select x cluster.
You can go ahead and do a next.
As soon as you do that, you see there is one policy called as the x cluster policy that is automatically
added.
Let's do next.
And within here you can give a name.
Let me just call it as x cluster rule once.
Then let's go a bit down.
You can go ahead and create a role.
Once the role is created, you can go back to the X console, you can refresh this, and from here you
can select the X cluster rule once.
Then let's go a bit down.
We'll click on next.
Within here, you can go ahead and select the VPC and the subnets.
I leave it to be the default.
So you have the default VPC over here.
You can also go ahead and select the security group.
So in my case, there are multiple security groups that are currently available.
So in fact, let's do one thing.
Let's create a security group for the resources that will be used by X.
So from the EC two console, we'll go to security groups.
Let's create a new security group.
I'll just call it as x hyphen.
SD And within the inbound rule, we'll keep it very simple.
I'll just say all traffic allowed from everyone.
All right.
And we'll go ahead and create a security group here.
All right.
So we forgot the description.
I'll say for X resources once, then you can go ahead and create the security group.
Great.
So going back to the cluster, let's rephrase the security group here and let's find our X is Z.
So we have the X as you select this.
The next important configuration here is to choose the cluster IP address family.
I'll be using the IPV four.
Only the next important part is the cluster endpoint access we were discussing over here is the cluster
endpoint access.
So you can either make the cluster public or private for production environment.
You should never make it public.
Very important part to remember.
However, for our testing environment, I'll be using the public endpoint over here.
The next important part is the networking add ons, so you can select the versions of the networking
add ons that are available.
Let me just select the latest version as of now for the VPC CCNA plug in.
All right.
You can even leave it default.
It does not really matter at this stage once.
Then you can click on next if you like, that there should be logging associated with the Kubernetes
components for production environment.
This is very useful.
You can go ahead and enable it.
However, we will keep it simple.
I'll leave it as default, which is disable.
I'll click on next.
You have the review screen and we'll go ahead and create the Kubernetes cluster grid.
So the status of the cluster is in the creating stage.
So as of now, we have completed the step one, which is to build the X.
Less than once the EAC cluster is built.
The second important step is to create a node group where you define the EC.
Two instances that will be part of your X cluster, and once the EC two instances are created, then
you can go ahead and deploy your application in X.
So let's refresh to see if it is created and it is still in the creating stage.
That is fine.
So till the time the X cluster gets created, let's go ahead and launch an easy to instance.
So this easy to instance we will be using to connect to the x cluster and deploy some application.
Now again, note that this is two instances, not mandatory.
You can also go ahead and download the Cube CTL, which is used to connect to the Kubernetes cluster
in your laptop and configure it.
However, to standardize things, I'll be using a SC to instance here, so I'll just call it as demo.
Easy to will keep everything as simple.
The only thing that we'll be needing here is the key pad so that we can log in to the EC two.
Once this is done, you can go ahead and launch the instance here.
So let's go to the EC two grid.
So the instance state is running.
So let me go ahead and quickly connect to the instance here.
So from my terminal I'll go ahead and quickly ssh into the instance grid.
The next important part is to download the Cube CTL Binary Cube.
CTL allows us to connect to the Kubernetes cluster.
So if you want to deploy some application into the cluster, create some resources, you can make use
of Cube CTL here.
So you can also download it directly into your workstation.
It does not really matter.
Now, one important part to remember is that try to make sure that the Cube CTL version is equivalent
to the Kubernetes version.
For example, let's say Kubernetes version is 1.23.
And if you're using a cube CTL version of 1.18, so that will create issues.
So make sure at a high level overview, just keep it as a similar version here.
Now, if we look into this documentation, we have the Cube CTL version of 1.23.
So let's copy this.
Let me switch to the root user and let's run the kernel command over here.
So you have the Cube CTL binary.
I'll just make it executable and we'll move it to user local bin.
All right.
Now if you just type Cube CTL, it will show you the basic set of commands that are available.
Great.
So let's go back to the cluster.
Let's refresh to see if it is created and it is still in the creation stage.
So till the time it is created, let's also complete one more step.
So basically, once your Kubernetes cluster is created, you will have to go ahead and connect to it.
Now we know that we can connect to it using Cube CTL, but one of the important part here is authentication.
It's not that everyone from the Internet will be able to connect and deploy the resources to your Kubernetes
cluster.
There needs to be some kind of authentication that is required, and one of the authentication that
is available is using the IAM.
Now within your I have created the Kubernetes cluster using a IAM user of demo labs.
So you will have to make sure that you use the access and secret keys associated with the same IAM user
as part of your initial authentication to the cluster.
This is very important in case if you're using a different time user, just make sure that you generate
the access and secret key associated with the IAM user that has created this cluster.
All right.
In my case I have used demo labs, so let me go ahead and generate the access and secret key associated
with the demo labs user.
So let's go to the security credentials.
There is already one access and secret key that is available.
In fact, let me just make it inactive for the time being.
We do not need it.
I'll generate a new set of keys.
Let's copy this within the easy to I'll do a configure.
I'll add the access key.
I like the secret key and in the region.
Just make sure to use the same region where your cluster is created.
So in my case, it is the California region, which is US West one.
So I'll say us West one, and that's about it.
One more thing you have to ensure is that this user has the appropriate permission.
In my case, this user has administrator access.
So this is not going to be an issue.
So now let's see if X is ready.
And finally, once steps are completed, R cluster is also ready.
So now that we know that the cluster is available, if you see this is the end point to connect to the
cluster.
However, before we do that, let's go ahead and deploy some resources within the Kubernetes cluster.
So I'll go to compute.
We'll go ahead and will be adding a node group over here.
Let's just call it as a demo node group and within you'll also need to create a node.
IAM rule.
This is something that we've already discussed that the node group EC two instances will need basic
permissions related to ACR network interfaces and so on.
So you need to associate the IAM rule.
So let's also go ahead and create a IAM role for the node group resources.
So I'll create a role here.
Now if you look into the policy that we need to add associated with the x node, there are three important
one.
You have the x worker node policy, the container registry and the CNI related policy.
So let's go ahead and try it out.
So within here I'll be selecting the EC two.
Let's do our next.
And there are certain policies as we're discussing.
First one is Amazon X Worker.
Let's find the policy here.
So this is the worker node policy.
I'll select this.
Let's clear the screen.
Let's say Amazon EC two container.
We just want the read only access.
So I'll select this.
Let's clear the screen.
And third one is Amazon X underscore CNA.
So I'll select this.
Let's do our next and let's provide a role name, I'll just call it as Amazon X node role.
There are three policies that are associated here.
Once then you can create a role.
So the role is created.
Once this is done, you can refresh this and we have the x node role here.
Let's go a bit down now will not be configuring other things.
We'll keep it simple.
The important part here is the compute configuration.
What are the compute type resources that you need as part of your cluster?
So you have capacity type of on demand, the army type over here as well as the instance type.
So the instance type here is TX three dot medium, which makes use of two v CPU and memory of four GB.
In case if you'd like, you can also use much smaller instance.
In fact, let me select this and I'll use DT three dot small.
You can specify the disk size and within here you can specify the node group scaling configuration like
how many EC two instances that you need as part of your cluster.
I'll just say one, one and one for all of this.
Let's do a next.
We'll leave this as default.
Let's do our next.
You have the review screen over here.
We'll go ahead and we'll create the node.
Now, at this stage there will be one EC two instance that will be launched.
In fact, let's try it out.
And if you refresh, you see that we have one easy two instance that is getting launched.
The instance type is DT three dot small and this is where your application will be running if you deploy
to Kubernetes.
Now from the EC two instance for our Q CTL client to connect to the Kubernetes cluster, we need the
information related to the Kubernetes cluster.
Like example.
Let's go back to the ECS cluster.
You see you have the API server endpoint.
So this is the endpoint that you can use to connect to the cluster.
And this is where the authentication will also happen.
So all of this details needs to be added in the EC two instance or in your laptop where your CTL binary
is present, what you need to do.
Instead of manually adding the details, you can run just one simple command.
It is mentioned in the documentation.
I'll also be adding this after this video so that you can directly try it out.
So within here the only thing that you have to change is the region code and the name of the cluster.
So let's go ahead and copy this.
Let's clear the screen.
I'll run this command.
The name of the cluster is Demo X Cluster and the region code.
I'll say us west one once.
Then if I press enter, a new configuration is created.
So if I just quickly open this file, you see all.
Automatically.
All the details related to the case cluster are populated.
For example, the URL of the ex cluster and various other information.
Once this is done, you can run the basic Kubernetes commands, for example, CTL, Gate SVC, which
shows what are the services that are running in the Kubernetes cluster.
You can also do Cube CTL get nodes.
This will show you the worker nodes that are available.
As of now, there is one worker node that is available.
So this is the easy two instance that we had launched.
The status is ready.
So if you go ahead and deploy a specific container, let's say Cube, CTL, run Engine X with the image
of engine X.
All right, so the port is created.
If we do a cube, CTL, get ports over here.
Our engine export is running.
All right.
In case if you'd like to see, you can also see it from the GI.
So in the resources, we have a port resource.
We created a new port.
The name is Engine X here.
Great.
So I hope at a high level overview, you understood the practical steps associated with the x, the
documentation link, and the commands that we have used in today's video.
I'll be adding it after this lecture so that you can easily reference to it.