Linux Administrator Virtualization

Create EKS with an Existing VPC – AWS EKS

Introduction

Create EKS with an Existing VPC: – Creating an Amazon Elastic Kubernetes Service (EKS) cluster with an existing Virtual Private Cloud (VPC) allows you to leverage your existing network infrastructure while benefiting from the managed Kubernetes service provided by AWS. This integration enables you to deploy and manage containerized applications using Kubernetes without the need to create a separate VPC for your EKS cluster. In this guide, we will explore the steps involved in creating an EKS cluster with an existing VPC on AWS.

Overview of Creating EKS with an Existing VPC

Are you curious about how to create an Amazon Elastic Kubernetes Service (EKS) with an existing Virtual Private Cloud (VPC)? Look no further! In this article, we will provide an overview of the process and guide you through the necessary steps. So, let’s dive in and explore the world of EKS and VPC integration.

Firstly, let’s understand what EKS and VPC are. Amazon EKS is a fully managed service that makes it easy to run Kubernetes on AWS. It eliminates the need to install, operate, and scale your own Kubernetes clusters. On the other hand, a Virtual Private Cloud (VPC) is a virtual network dedicated to your AWS account. It provides you with control over your virtual networking environment, including IP address ranges, subnets, route tables, and network gateways.

Now that we have a basic understanding of EKS and VPC, let’s move on to creating an EKS cluster with an existing VPC. The process involves a few steps, but don’t worry, we’ll guide you through each one.

The first step is to ensure that you have an existing VPC that meets the requirements for EKS. These requirements include having at least two private subnets and two public subnets spread across different availability zones. Additionally, you need to have an internet gateway and a NAT gateway configured in your VPC.

Once you have a suitable VPC, the next step is to create an Amazon EKS cluster. You can do this through the AWS Management Console, AWS CLI, or AWS SDKs. During the cluster creation process, you will need to specify the VPC and subnets you want to use. Make sure to select the appropriate subnets that meet the EKS requirements mentioned earlier.

After creating the EKS cluster, you need to configure the security group rules to allow inbound and outbound traffic. This step is crucial for enabling communication between the EKS cluster and other resources in your VPC. You can define these rules using the AWS Management Console or by using the AWS CLI.

Once the security group rules are set up, you can now launch worker nodes in your existing VPC. These worker nodes will join the EKS cluster and handle the workload. You can choose to launch the worker nodes using the Amazon EKS-optimized Amazon Machine Image (AMI) or a custom AMI. The choice depends on your specific requirements and preferences.

Finally, you need to configure the worker nodes to communicate with the EKS cluster. This involves setting up the necessary authentication and authorization mechanisms. You can achieve this by using the AWS CLI or the AWS Management Console. Once the configuration is complete, your worker nodes will be ready to handle the workload and communicate with the EKS cluster seamlessly.

Example:

This is the example for eksctl confi file with subnet ids. Please change some details before using this.

apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
  name: acme-test-cluster
  region: us-east-2
  version: "1.17"

vpc:
  subnets:
    private:
      us-east-2a: { id: subnet-01234567890abcdef }
      us-east-2b: { id: subnet-01234567890abcdf0 }
      us-east-2c: { id: subnet-01234567890abcdf1 }
    public:
      us-east-2a: { id: subnet-01234567890abcdf2 }
      us-east-2b: { id: subnet-01234567890abcdf3 }
      us-east-2c: { id: subnet-01234567890abcdf4 }

managedNodeGroups:
  - name: acme-test-cluster
    minSize: 3
    maxSize: 6
    desiredCapacity: 3
    instanceType: m5.2xlarge
    labels: {role: worker}
    ssh:
      publicKeyName: deploykey
    tags:
      nodegroup-role: worker
    iam:
      withAddonPolicies:
        externalDNS: true
        certManager: true
        albIngress: true

Before using this you will need to change the file cluster_config.yaml.

  • Name and Region: Update the region if you are using a different region.
  • Subnet IDs: You have to update the subnet Ids to match the AZ. You can use either Public or Private subnet.
  • Instance Type: Change the instance type to matches the desired workload.
  • KeyPair: To togin to worker nodes to troubleshoot or apply the security patches.

Create Cluster

Now create the cluster using this below command.

eksctl create cluster --config-file ./cluster_config.yaml

In conclusion, creating an EKS cluster with an existing VPC is a straightforward process that involves a few essential steps. By following these steps, you can integrate your VPC with EKS and leverage the benefits of both services. So, why wait? Start exploring the world of EKS and VPC integration today and unlock the full potential of your AWS infrastructure.

Conclusion

In conclusion, creating an Amazon Elastic Kubernetes Service (EKS) cluster with an existing Virtual Private Cloud (VPC) in AWS allows for greater flexibility and control over the network configuration. This approach enables seamless integration of EKS with existing resources and simplifies the management of networking policies and security groups. By leveraging an existing VPC, users can take advantage of their established network architecture and easily deploy and manage containerized applications using EKS.

Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.

About the author

mm

Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment