Wednesday, November 21, 2018

Configure EKS cluster

To configure the Kubernetes cluster, you can use the created Ubuntu server. steps are mentioned below,

1. SSH into your Ubuntu server

2. Go into Root

3. Update the kernel and install transport layer

# sudo apt-get update && apt-get install -y apt-transport-https

clip_image002

4. Add the required keys

# curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -

clip_image004

# cat <<EOF>/etc/apt/sources.list.d/kubernetes.list

>deb http://apt.kubernetes.io/ kubernetes-xenial main

>EOF

clip_image006

5. Update the package

# apt-get update

6. Install Kubectl

# sudo apt-get install -y kubectl

clip_image008

7. Download Kops

# wget https://github.com/kubernetes/kops/releases/download/1.8.0/kops-linux-amd64

clip_image010

clip_image012

1. Add required permission to the Kops folder

# chmod +x kops-linux-amd64

# mv kops-linux-amd64 /usr/local/bin/kops

clip_image002[6]

2. Put the public ssh key on home folder

# ssh-keygen

clip_image004[6]

3. Create the cluster. This will not create the cluster but will create the require configuration which helps to create the cluster. You can change the DNS with your own one. And I’m creating this cluster on Souteastasia region and that details can be found under the instance description.

# kops create cluster --zones=ap-southeast-1a cloudwar.xyz

clip_image006[4]

As you can see in the above print screen, before running the cluster create command you have to introduce the S3 bucket location where can store the cluster configuration details.

4. Set the S3 Bucket location

# export KOPS_STATE_STORE=s3://kuberneteshemalxyz.com

clip_image008[4]

As mentioned this will create only the configuration files. Then you must run “kops update cluster cloudwar.xyz --yes” command to install the cluster.

  • kops get cluster - This will list the configured cluster.
  • kops edit cluster cloudwar.xyz – Can edit this cluster. Min max of the nodes
  • kops edit ig --name=cloudwar.xyz nodes – Can edit the node instance group
  • kops edit ig --name=cloudwar.xyz master-ap-s - Can edit master instance group
  • kops update cluster cloudwar.xyz –yes - Configure the cluster

clip_image010[4]

If you go to the AWS EC3 instance console now you can see New three VMs were automatically added there.

clip_image012[4]

In Autos calling group there are two groups created.

clip_image014

You can validate the cluster by running “kops validate cluster”

The nodes details can be seen by running “kubectl get nodes --show-labels”

To ssh to the master Node you can run “ ssh -i ~/.ssh/id_rsa admin@api.cloudwar.xyz” This DNS need to be change with the DNS that you have configured.

No comments:

Post a Comment