How do I build an eks index vpccni with Pulumi?TypeScript
To create an Amazon EKS cluster with "aws.vpc.Cni" setting which refers to the Amazon VPC CNI plugin for Kubernetes networking, you would use the
aws.eks.Clusterresource from the
awspackage in Pulumi.
The Amazon VPC CNI offers integrated AWS Virtual Private Cloud (VPC) networking for Kubernetes pods. This provides several advantages including:
- Native VPC networking performance for pods
- Compatibility with VPC flow logs, VPC routing policies and network traffic mirroring
- Granular control over subnet and IP selection.
Here is a simplified TypeScript code example:
This program does the following:
- It creates a new AWS IAM Role that we will use for the EKS cluster.
- It attaches the AmazonEKS service policy to the IAM role which is required for EKS service to have necessary permissions to function.
- It creates a new AWS Security Group to use with the EKS cluster.
- The EKS cluster is managed by AWS and the Amazon VPC CNI plugin for Kubernetes is installed by default.
- It exports the
kubeconfigthat you can use with
kubectlto manage your Kubernetes cluster.
Please replace the subnet IDs with your actual subnet IDs in your VPC where you want the EKS cluster.
Once the cluster is created, the Amazon VPC CNI plugin for Kubernetes networking will be installed by default in your EKS cluster. You can then create and configure your Kubernetes pods to run and communicate with each other within your VPC.
Check out the EKS Cluster Pulumi Documentation for more details.