Elastic Kubernetes service (Single-tier architecture)
Today, I want to share with you guys a great concept of amazon AWS which is EKS( Elastic Kubernetes Service ).
Q) First, what is exactly Eks?
>>>Amazon Elastic Kubernetes Service (Amazon EKS) is a managed service that makes it easy for you to run Kubernetes on AWS without needing to stand up or maintain your own Kubernetes control plane.
If you can't know about this much. Don't worry !!!
I would like to share with you guys a practical how we can use Eks to deploy your server or web app.
Here we use CLI to use Eks services.
For this first, you need to install AWS CLI cmd. Here I use AWS CLI version 2. It's new and updated. Make sure you also download the same.
For downloading use this reference>>> Click here
After download first, you need to authenticate in CLI for this use
>>> aws configure
In the end, after user-created, they give you access and secret key which is required to put in aws configure cmd for authentication.
After that, you authenticate you also need to download 1 more cmd eksctl. This eksctl cmd manages your Eks cluster.
for download this use reference >>> Click here
check your command is installed successfully or not. use
>>> eksctl version
Its good practice to create a separate folder. That is called
Workspace. After that, you need to create a cluster. For creating a cluster we need to create a yml file.
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: basic-cluster
region: ap-south-1
nodeGroups:
- name: ng-1
instanceType: t2.micro
desiredCapacity: 2
Here,
In node groups >>>means how many nodes you want.
Like in my case I need 3 node groups of t2.micro instance.
For more info about this, you can take reference from here
Then write command
>>> eksctl create cluster -f filename.yml
It takes 15-20 minutes to create a cluster. That is a fully managed master node. But here they can't manage slave nodes. For this, there is a one more service available in AWS which is Forgate. Maybe I talk about this more in my upcoming blog...
Here you need to download one more command which is used to contact the cluster of Kubernetes or the API server.
Kubectl cmd
For downloading this you can take reference from here
Then you need to tell this where is your cluster. for this use
>>> aws eks update-kubeconfig --name clustername
Now our setup is ready to do the things.
Then if you know about kubectl cmd your work is very easy. Otherwise, I am here to tell you.
>>> eksctl get cluster
So they show how many clusters they have
>>> Kubectl get pods
so they show how many podes they have
If you see above I also create 1 namespace. It's just a separate room like this.
>>> kubectl create namespace name
>>>kubectl get ns
Then create your deployment
>>>kubectl create deployment name
--image=imagename
here I use Owncloud image
To show all the services in Kubernetes. There is a great command in Kubernetes.
>>> kubectl get all
If you want to launch the replicas of your environment use
>>> kubectl scale deployment --replicas=.......
But till that time you create this environment on your environment. That means private. But if you want to make this public so you need to expose this. for this use
>>> kubectl expose deployment name --type= LoadBalancer --port=.....
Here you write which port you want to expose.
Like In my below image.
In my case own cloud works on port 80 so I expose that port.
Here when you choose to type load balancer so AWS creates a separate ELB for you. If you want to know you the expose port.So use
>>>kubectl get services
or
>>> kubectl get all
Here you see the external IP which is given by load balancer. that means internally they balance the load also.
In my case, if you use this external IP so it gives your web app or app server. which has internally load-balanced also.
Output in my case >>>
But my work is not done here.
You can also see in this above image. They also give a warning to us. As when we use this storage so it impacts our performance.
END OF PART - 1
I also want to show you this same practical with a more easy and automated way and also more real-life use case.
If you also want to see that so click here
I will come back with new task soon stay stunned with me.
Thank you for reading.......
No comments:
Post a Comment