Kubernetes Cluster on AWS
The AWS Kubernetes Cluster template scaffolds a Pulumi project that provisions a managed Amazon EKS cluster inside a new VPC with public and private subnets. Worker nodes run in the private subnets for improved security; load balancers created by cluster workloads are automatically placed in the public subnets.
Before you begin#
For this walkthrough, you'll need:
- The Pulumi CLI
- An AWS account with programmatic access
- The AWS CLI (optional, but recommended and used in this guide)
- Permission to manage Amazon EKS, EC2, and IAM
- The kubectl CLI
For this walkthrough, you'll need:
- The Pulumi CLI
- An AWS account with programmatic access
- The AWS CLI (optional, but recommended and used in this guide)
- Permission to manage Amazon EKS, EC2, and IAM
- The kubectl CLI
For this walkthrough, you'll need:
- The Pulumi CLI
- An AWS account with programmatic access
- The AWS CLI (optional, but recommended and used in this guide)
- Permission to manage Amazon EKS, EC2, and IAM
- A current version of Go installed locally
- The kubectl CLI
For this walkthrough, you'll need:
- The Pulumi CLI
- An AWS account with programmatic access
- The AWS CLI (optional, but recommended and used in this guide)
- Permission to manage Amazon EKS, EC2, and IAM
- A current version of .NET installed locally
- The kubectl CLI
For this walkthrough, you'll need:
- The Pulumi CLI
- An AWS account with programmatic access
- The AWS CLI (optional, but recommended and used in this guide)
- Permission to manage Amazon EKS, EC2, and IAM
- The kubectl CLI
For this walkthrough, you'll need:
- A current version of the Pulumi CLI (Pulumi HCL requires no additional runtime)
- An AWS account with programmatic access
- The AWS CLI (optional, but recommended and used in this guide)
- Permission to manage Amazon EKS, EC2, and IAM
- The kubectl CLI
Create a new project#
Create a new project from the template:
mkdir my-k8s-cluster; cd my-k8s-clusterpulumi new kubernetes-aws-typescriptmkdir my-k8s-cluster; cd my-k8s-clusterpulumi new kubernetes-aws-typescriptmkdir my-k8s-cluster; cd my-k8s-clusterpulumi new kubernetes-aws-pythonmkdir my-k8s-cluster; cd my-k8s-clusterpulumi new kubernetes-aws-pythonmkdir my-k8s-cluster; cd my-k8s-clusterpulumi new kubernetes-aws-gomkdir my-k8s-cluster; cd my-k8s-clusterpulumi new kubernetes-aws-gomkdir my-k8s-cluster; cd my-k8s-clusterpulumi new kubernetes-aws-csharpmkdir my-k8s-cluster; cd my-k8s-clusterpulumi new kubernetes-aws-csharpmkdir my-k8s-cluster; cd my-k8s-clusterpulumi new kubernetes-aws-yamlmkdir my-k8s-cluster; cd my-k8s-clusterpulumi new kubernetes-aws-yamlmkdir my-k8s-cluster; cd my-k8s-clusterpulumi new kubernetes-aws-hclmkdir my-k8s-cluster; cd my-k8s-clusterpulumi new kubernetes-aws-hclThe pulumi new command walks you through creating and configuring the new project and stack. A stack is an instance of a project, and you can have many of them (dev, staging, prod), each with its own configuration settings. Depending on the language, you may also be asked for your preferred package manager or toolchain.
This template’s settings include:
| Key | Description | Default |
|---|---|---|
| aws:region | The AWS region to deploy into | us-west-2 |
| minClusterSize | Minimum size (number of nodes) of cluster | 3 |
| maxClusterSize | Maximum size (number of nodes) of cluster | 6 |
| desiredClusterSize | Desired number of nodes in the cluster | 3 |
| eksNodeInstanceType | Instance type to use for worker nodes | t3.medium |
| vpcNetworkCidr | Network CIDR to use for new VPC | 10.0.0.0/16 |
pulumi config set
:
pulumi config set aws:region <value>pulumi config set minClusterSize <value>pulumi config set maxClusterSize <value>pulumi config set desiredClusterSize <value>pulumi config set eksNodeInstanceType <value>pulumi config set vpcNetworkCidr <value>pulumi config set aws:region "<value>"pulumi config set minClusterSize "<value>"pulumi config set maxClusterSize "<value>"pulumi config set desiredClusterSize "<value>"pulumi config set eksNodeInstanceType "<value>"pulumi config set vpcNetworkCidr "<value>"| Key | Description | Default |
|---|---|---|
| aws:region | The AWS region to deploy into | us-west-2 |
| minClusterSize | Minimum size (number of nodes) of cluster | 3 |
| maxClusterSize | Maximum size (number of nodes) of cluster | 6 |
| desiredClusterSize | Desired number of nodes in the cluster | 3 |
| eksNodeInstanceType | Instance type to use for worker nodes | t3.medium |
| vpcNetworkCidr | Network CIDR to use for new VPC | 10.0.0.0/16 |
pulumi config set
:
pulumi config set aws:region <value>pulumi config set minClusterSize <value>pulumi config set maxClusterSize <value>pulumi config set desiredClusterSize <value>pulumi config set eksNodeInstanceType <value>pulumi config set vpcNetworkCidr <value>pulumi config set aws:region "<value>"pulumi config set minClusterSize "<value>"pulumi config set maxClusterSize "<value>"pulumi config set desiredClusterSize "<value>"pulumi config set eksNodeInstanceType "<value>"pulumi config set vpcNetworkCidr "<value>"| Key | Description | Default |
|---|---|---|
| aws:region | The AWS region to deploy into | us-west-2 |
| minClusterSize | Minimum size (number of nodes) of cluster | 3 |
| maxClusterSize | Maximum size (number of nodes) of cluster | 6 |
| desiredClusterSize | Desired number of nodes in the cluster | 3 |
| eksNodeInstanceType | Instance type to use for worker nodes | t3.medium |
| vpcNetworkCidr | Network CIDR to use for new VPC | 10.0.0.0/16 |
pulumi config set
:
pulumi config set aws:region <value>pulumi config set minClusterSize <value>pulumi config set maxClusterSize <value>pulumi config set desiredClusterSize <value>pulumi config set eksNodeInstanceType <value>pulumi config set vpcNetworkCidr <value>pulumi config set aws:region "<value>"pulumi config set minClusterSize "<value>"pulumi config set maxClusterSize "<value>"pulumi config set desiredClusterSize "<value>"pulumi config set eksNodeInstanceType "<value>"pulumi config set vpcNetworkCidr "<value>"| Key | Description | Default |
|---|---|---|
| aws:region | The AWS region to deploy into | us-west-2 |
| minClusterSize | Minimum size (number of nodes) of cluster | 3 |
| maxClusterSize | Maximum size (number of nodes) of cluster | 6 |
| desiredClusterSize | Desired number of nodes in the cluster | 3 |
| eksNodeInstanceType | Instance type to use for worker nodes | t3.medium |
| vpcNetworkCidr | Network CIDR to use for new VPC | 10.0.0.0/16 |
pulumi config set
:
pulumi config set aws:region <value>pulumi config set minClusterSize <value>pulumi config set maxClusterSize <value>pulumi config set desiredClusterSize <value>pulumi config set eksNodeInstanceType <value>pulumi config set vpcNetworkCidr <value>pulumi config set aws:region "<value>"pulumi config set minClusterSize "<value>"pulumi config set maxClusterSize "<value>"pulumi config set desiredClusterSize "<value>"pulumi config set eksNodeInstanceType "<value>"pulumi config set vpcNetworkCidr "<value>"| Key | Description | Default |
|---|---|---|
| aws:region | The AWS region to deploy into | us-west-2 |
| minClusterSize | Minimum size (number of nodes) of cluster | 3 |
| maxClusterSize | Maximum size (number of nodes) of cluster | 6 |
| desiredClusterSize | Desired number of nodes in the cluster | 3 |
| eksNodeInstanceType | Instance type to use for worker nodes | t3.medium |
| vpcNetworkCidr | Network CIDR to use for new VPC | 10.0.0.0/16 |
pulumi config set
:
pulumi config set aws:region <value>pulumi config set minClusterSize <value>pulumi config set maxClusterSize <value>pulumi config set desiredClusterSize <value>pulumi config set eksNodeInstanceType <value>pulumi config set vpcNetworkCidr <value>pulumi config set aws:region "<value>"pulumi config set minClusterSize "<value>"pulumi config set maxClusterSize "<value>"pulumi config set desiredClusterSize "<value>"pulumi config set eksNodeInstanceType "<value>"pulumi config set vpcNetworkCidr "<value>"| Key | Description | Default |
|---|---|---|
| aws:region | The AWS region to deploy into | us-west-2 |
| min_cluster_size | The minimum number of nodes in the cluster | 3 |
| max_cluster_size | The maximum number of nodes in the cluster | 6 |
| desired_cluster_size | The desired number of nodes in the cluster | 3 |
| node_instance_type | The EC2 instance type to use for worker nodes | t3.medium |
| vpc_network_cidr | The network CIDR to use for the VPC | 10.0.0.0/16 |
pulumi config set
:
pulumi config set aws:region <value>pulumi config set min_cluster_size <value>pulumi config set max_cluster_size <value>pulumi config set desired_cluster_size <value>pulumi config set node_instance_type <value>pulumi config set vpc_network_cidr <value>pulumi config set aws:region "<value>"pulumi config set min_cluster_size "<value>"pulumi config set max_cluster_size "<value>"pulumi config set desired_cluster_size "<value>"pulumi config set node_instance_type "<value>"pulumi config set vpc_network_cidr "<value>"Review the code#
When setup completes, you’ll see a few files:
Pulumi.yamlcontains the project name and the language it’s written in.Pulumi.dev.yamlcontains thedevstack’s settings, including the values you just entered.index.tsindex.js__main__.pymain.goProgram.csProgram.fsProgram.vbApp.javaPulumi.yamlmain.tfcontains the program code that declares your cloud resources.
When setup completes, you’ll see a few files:
Pulumi.yamlcontains the project name and the language it’s written in.Pulumi.dev.yamlcontains thedevstack’s settings, including the values you just entered.index.tsindex.js__main__.pymain.goProgram.csProgram.fsProgram.vbApp.javaPulumi.yamlmain.tfcontains the program code that declares your cloud resources.
When setup completes, you’ll see a few files:
Pulumi.yamlcontains the project name and the language it’s written in.Pulumi.dev.yamlcontains thedevstack’s settings, including the values you just entered.index.tsindex.js__main__.pymain.goProgram.csProgram.fsProgram.vbApp.javaPulumi.yamlmain.tfcontains the program code that declares your cloud resources.
When setup completes, you’ll see a few files:
Pulumi.yamlcontains the project name and the language it’s written in.Pulumi.dev.yamlcontains thedevstack’s settings, including the values you just entered.index.tsindex.js__main__.pymain.goProgram.csProgram.fsProgram.vbApp.javaPulumi.yamlmain.tfcontains the program code that declares your cloud resources.
When setup completes, you’ll see a few files:
Pulumi.yamlcontains the project name and the resources it declares.Pulumi.dev.yamlcontains thedevstack’s settings, including the values you just entered.
When setup completes, you’ll see a few files:
Pulumi.yamlcontains the project name and the language it’s written in.Pulumi.dev.yamlcontains thedevstack’s settings, including the values you just entered.index.tsindex.js__main__.pymain.goProgram.csProgram.fsProgram.vbApp.javaPulumi.yamlmain.tfcontains the program code that declares your cloud resources.
Take a moment to open them up and have a look. Here’s what’s in index.tsindex.js__main__.pymain.goProgram.csProgram.fsProgram.vbApp.javaPulumi.yamlmain.tf:
import * as pulumi from "@pulumi/pulumi";import * as awsx from "@pulumi/awsx";import * as eks from "@pulumi/eks";
// Grab some values from the Pulumi configuration (or use default values)const config = new pulumi.Config();const minClusterSize = config.getNumber("minClusterSize") || 3;const maxClusterSize = config.getNumber("maxClusterSize") || 6;const desiredClusterSize = config.getNumber("desiredClusterSize") || 3;const eksNodeInstanceType = config.get("eksNodeInstanceType") || "t3.medium";const vpcNetworkCidr = config.get("vpcNetworkCidr") || "10.0.0.0/16";
// Create a new VPCconst eksVpc = new awsx.ec2.Vpc("eks-vpc", { enableDnsHostnames: true, cidrBlock: vpcNetworkCidr,});
// Create the EKS clusterconst eksCluster = new eks.Cluster("eks-cluster", { // Put the cluster in the new VPC created earlier vpcId: eksVpc.vpcId, // Use the "API" authentication mode to support access entries authenticationMode: eks.AuthenticationMode.Api, // Public subnets will be used for load balancers publicSubnetIds: eksVpc.publicSubnetIds, // Private subnets will be used for cluster nodes privateSubnetIds: eksVpc.privateSubnetIds, // Change configuration values to change any of the following settings instanceType: eksNodeInstanceType, desiredCapacity: desiredClusterSize, minSize: minClusterSize, maxSize: maxClusterSize, // Do not give the worker nodes public IP addresses nodeAssociatePublicIpAddress: false, // Change these values for a private cluster (VPN access required) endpointPrivateAccess: false, endpointPublicAccess: true,});
// Export some values for use elsewhereexport const kubeconfig = eksCluster.kubeconfig;export const vpcId = eksVpc.vpcId;import pulumiimport pulumi_awsx as awsximport pulumi_eks as eks
# Get some values from the Pulumi configuration (or use defaults)config = pulumi.Config()min_cluster_size = config.get_int("minClusterSize", 3)max_cluster_size = config.get_int("maxClusterSize", 6)desired_cluster_size = config.get_int("desiredClusterSize", 3)eks_node_instance_type = config.get("eksNodeInstanceType", "t3.medium")vpc_network_cidr = config.get("vpcNetworkCidr", "10.0.0.0/16")
# Create a VPC for the EKS clustereks_vpc = awsx.ec2.Vpc("eks-vpc", enable_dns_hostnames=True, cidr_block=vpc_network_cidr)
# Create the EKS clustereks_cluster = eks.Cluster("eks-cluster", # Put the cluster in the new VPC created earlier vpc_id=eks_vpc.vpc_id, # Use the "API" authentication mode to support access entries authentication_mode=eks.AuthenticationMode.API, # Public subnets will be used for load balancers public_subnet_ids=eks_vpc.public_subnet_ids, # Private subnets will be used for cluster nodes private_subnet_ids=eks_vpc.private_subnet_ids, # Change configuration values to change any of the following settings instance_type=eks_node_instance_type, desired_capacity=desired_cluster_size, min_size=min_cluster_size, max_size=max_cluster_size, # Do not give worker nodes a public IP address node_associate_public_ip_address=False, # Change these values for a private cluster (VPN access required) endpoint_private_access=False, endpoint_public_access=True )
# Export values to use elsewherepulumi.export("kubeconfig", eks_cluster.kubeconfig)pulumi.export("vpcId", eks_vpc.vpc_id)package main
import ( "github.com/pulumi/pulumi-awsx/sdk/v3/go/awsx/ec2" "github.com/pulumi/pulumi-eks/sdk/v4/go/eks" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" "github.com/pulumi/pulumi/sdk/v3/go/pulumi/config")
func main() { pulumi.Run(func(ctx *pulumi.Context) error { // Get some configuration values or set default values cfg := config.New(ctx, "") minClusterSize, err := cfg.TryInt("minClusterSize") if err != nil { minClusterSize = 3 } maxClusterSize, err := cfg.TryInt("maxClusterSize") if err != nil { maxClusterSize = 6 } desiredClusterSize, err := cfg.TryInt("desiredClusterSize") if err != nil { desiredClusterSize = 3 } eksNodeInstanceType, err := cfg.Try("eksNodeInstanceType") if err != nil { eksNodeInstanceType = "t3.medium" } vpcNetworkCidr, err := cfg.Try("vpcNetworkCidr") if err != nil { vpcNetworkCidr = "10.0.0.0/16" }
// Create a new VPC, subnets, and associated infrastructure eksVpc, err := ec2.NewVpc(ctx, "eks-vpc", &ec2.VpcArgs{ EnableDnsHostnames: pulumi.Bool(true), CidrBlock: &vpcNetworkCidr, }) if err != nil { return err }
apiAuthMode := eks.AuthenticationModeApi // Create a new EKS cluster eksCluster, err := eks.NewCluster(ctx, "eks-cluster", &eks.ClusterArgs{ // Put the cluster in the new VPC created earlier VpcId: eksVpc.VpcId, // Use the "API" authentication mode to support access entries AuthenticationMode: &apiAuthMode, // Public subnets will be used for load balancers PublicSubnetIds: eksVpc.PublicSubnetIds, // Private subnets will be used for cluster nodes PrivateSubnetIds: eksVpc.PrivateSubnetIds, // Change configuration values above to change any of the following settings InstanceType: pulumi.String(eksNodeInstanceType), DesiredCapacity: pulumi.Int(desiredClusterSize), MinSize: pulumi.Int(minClusterSize), MaxSize: pulumi.Int(maxClusterSize), // Do not give the worker nodes a public IP address NodeAssociatePublicIpAddress: pulumi.BoolRef(false), // Change these values for a private cluster (VPN access required) EndpointPrivateAccess: pulumi.Bool(false), EndpointPublicAccess: pulumi.Bool(true), }) if err != nil { return err }
// Export some values in case they are needed elsewhere ctx.Export("kubeconfig", eksCluster.Kubeconfig) ctx.Export("vpcId", eksVpc.VpcId) return nil })}using Pulumi;using Awsx = Pulumi.Awsx;using Eks = Pulumi.Eks;using System.Collections.Generic;
return await Deployment.RunAsync(() =>{ // Grab some values from the Pulumi configuration (or use default values) var config = new Config(); var minClusterSize = config.GetInt32("minClusterSize") ?? 3; var maxClusterSize = config.GetInt32("maxClusterSize") ?? 6; var desiredClusterSize = config.GetInt32("desiredClusterSize") ?? 3; var eksNodeInstanceType = config.Get("eksNodeInstanceType") ?? "t3.medium"; var vpcNetworkCidr = config.Get("vpcNetworkCidr") ?? "10.0.0.0/16";
// Create a new VPC var eksVpc = new Awsx.Ec2.Vpc("eks-vpc", new() { EnableDnsHostnames = true, CidrBlock = vpcNetworkCidr, });
// Create the EKS cluster var eksCluster = new Eks.Cluster("eks-cluster", new() { // Put the cluster in the new VPC created earlier VpcId = eksVpc.VpcId,
// Use the "API" authentication mode to support access entries AuthenticationMode = Eks.AuthenticationMode.Api,
// Public subnets will be used for load balancers PublicSubnetIds = eksVpc.PublicSubnetIds,
// Private subnets will be used for cluster nodes PrivateSubnetIds = eksVpc.PrivateSubnetIds,
// Change configuration values to change any of the following settings InstanceType = eksNodeInstanceType, DesiredCapacity = desiredClusterSize, MinSize = minClusterSize, MaxSize = maxClusterSize,
// Do not give the worker nodes public IP addresses NodeAssociatePublicIpAddress = false,
// Change these values for a private cluster (VPN access required) EndpointPrivateAccess = false, EndpointPublicAccess = true, });
// Export some values for use elsewhere return new Dictionary<string, object?> { ["kubeconfig"] = eksCluster.Kubeconfig, ["vpcId"] = eksVpc.VpcId, };});name: my-projectdescription: A Pulumi YAML program to deploy a Kubernetes cluster on AWSruntime: yamlconfig: minClusterSize: type: integer default: 3 maxClusterSize: type: integer default: 6 desiredClusterSize: type: integer default: 3 eksNodeInstanceType: type: string default: t3.medium vpcNetworkCidr: type: string default: 10.0.0.0/16resources: # Create a VPC for the EKS cluster eks-vpc: type: awsx:ec2:Vpc properties: enableDnsHostnames: true cidrBlock: ${vpcNetworkCidr} # Create the EKS cluster eks-cluster: type: eks:Cluster properties: # Put the cluster in the new VPC created earlier vpcId: ${eks-vpc.vpcId} # Use the "API" authentication mode to support access entries authenticationMode: API # Public subnets will be used for load balancers publicSubnetIds: ${eks-vpc.publicSubnetIds} # Private subnets will be used for cluster nodes privateSubnetIds: ${eks-vpc.privateSubnetIds} # Change configuration section above to change any of the following settings instanceType: ${eksNodeInstanceType} desiredCapacity: ${desiredClusterSize} minSize: ${minClusterSize} maxSize: ${maxClusterSize} # Do not give the worker nodes public IP addresses nodeAssociatePublicIpAddress: false # Change these values for a private cluster (VPN access required) endpointPrivateAccess: false endpointPublicAccess: trueoutputs: # Output the Kubeconfig for the cluster kubeconfig: ${eks-cluster.kubeconfig} vpcId: ${eks-vpc.vpcId}terraform { required_providers { aws = { source = "pulumi/aws" } awsx = { source = "pulumi/awsx" } eks = { source = "pulumi/eks" } kubernetes = { source = "pulumi/kubernetes" } }}
variable "min_cluster_size" { description = "Minimum size (number of nodes) of cluster" type = number default = 3}
variable "max_cluster_size" { description = "Maximum size (number of nodes) of cluster" type = number default = 6}
variable "desired_cluster_size" { description = "Desired number of nodes in the cluster" type = number default = 3}
variable "node_instance_type" { description = "Instance type to use for worker nodes" type = string default = "t3.medium"}
variable "vpc_network_cidr" { description = "Network CIDR to use for new VPC" type = string default = "10.0.0.0/16"}
# Create a VPC for the EKS clusterresource "awsx_ec2_vpc" "eks-vpc" { cidr_block = var.vpc_network_cidr enable_dns_hostnames = true}
# Create the EKS clusterresource "eks_cluster" "eks-cluster" { vpc_id = awsx_ec2_vpc.eks-vpc.vpc_id public_subnet_ids = awsx_ec2_vpc.eks-vpc.public_subnet_ids private_subnet_ids = awsx_ec2_vpc.eks-vpc.private_subnet_ids authentication_mode = "API"
instance_type = var.node_instance_type desired_capacity = var.desired_cluster_size min_size = var.min_cluster_size max_size = var.max_cluster_size
node_associate_public_ip_address = false endpoint_private_access = false endpoint_public_access = true}
# Output the Kubeconfig for the clusteroutput "kubeconfig" { value = eks_cluster.eks-cluster.kubeconfig sensitive = true}
output "vpc_id" { value = awsx_ec2_vpc.eks-vpc.vpc_id}Deploy the project#
Deploy with pulumi up. It starts with a preview of what it’s about to create and asks before it changes anything. Choose yes to deploy.
An EKS cluster takes 15 to 20 minutes to create, so expect pulumi up to run that long.
pulumi uppulumi upPulumi adds a random suffix to most resource names, so the cluster declared as eks-cluster gets a name like eks-cluster-eksCluster-4f8a2c1. This is autonaming. It lets you deploy the same program to more than one stack, and lets Pulumi create a replacement before it deletes the old resource, without names colliding.
When it finishes, Pulumi prints the stack’s outputs, values it only knows once the resources exist:
- kubeconfig
The cluster’s kubeconfig file, which you can use with
kubectlto access and communicate with your cluster.- vpcId
The ID of the VPC that your cluster is running in.
- kubeconfig
The cluster’s kubeconfig file, which you can use with
kubectlto access and communicate with your cluster.- vpcId
The ID of the VPC that your cluster is running in.
- kubeconfig
The cluster’s kubeconfig file, which you can use with
kubectlto access and communicate with your cluster.- vpcId
The ID of the VPC that your cluster is running in.
- kubeconfig
The cluster’s kubeconfig file, which you can use with
kubectlto access and communicate with your cluster.- vpcId
The ID of the VPC that your cluster is running in.
- kubeconfig
The cluster’s kubeconfig file, which you can use with
kubectlto access and communicate with your cluster.- vpcId
The ID of the VPC that your cluster is running in.
- vpc_id
The ID of the VPC that your cluster is running in.
- kubeconfig
The cluster’s kubeconfig file, which you can use with
kubectlto access and communicate with your cluster.
Read one any time with pulumi stack output <name>, or pass it to another command. Save the kubeconfig to a file and point kubectl at it to list the cluster’s nodes:
pulumi stack output kubeconfig --show-secrets > kubeconfigkubectl --kubeconfig kubeconfig get nodespulumi stack output kubeconfig --show-secrets | Out-File -Encoding ascii kubeconfigkubectl --kubeconfig kubeconfig get nodesYou should see three nodes with the status Ready. The kubeconfig gets its login token from the AWS CLI, so aws needs to be installed.
Need help?
If pulumi up reports No valid credential sources found or ExpiredToken, sign in again:
aws loginaws loginStill stuck? Let us know.
Customize the project#
Projects created with this template expose the following configuration settings:
- minClusterSize
The minimum number of nodes to allow in the cluster. Defaults to
3.- maxClusterSize
The maximum number of nodes to allow in the cluster. Defaults to
6.- desiredClusterSize
The desired number of nodes in the cluster. Defaults to
3.- eksNodeInstanceType
The EC2 instance type to use for the nodes. Defaults to
t3.medium.- vpcNetworkCidr
The network CIDR to use for the VPC. Defaults to
10.0.0.0/16.
- minClusterSize
The minimum number of nodes to allow in the cluster. Defaults to
3.- maxClusterSize
The maximum number of nodes to allow in the cluster. Defaults to
6.- desiredClusterSize
The desired number of nodes in the cluster. Defaults to
3.- eksNodeInstanceType
The EC2 instance type to use for the nodes. Defaults to
t3.medium.- vpcNetworkCidr
The network CIDR to use for the VPC. Defaults to
10.0.0.0/16.
- minClusterSize
The minimum number of nodes to allow in the cluster. Defaults to
3.- maxClusterSize
The maximum number of nodes to allow in the cluster. Defaults to
6.- desiredClusterSize
The desired number of nodes in the cluster. Defaults to
3.- eksNodeInstanceType
The EC2 instance type to use for the nodes. Defaults to
t3.medium.- vpcNetworkCidr
The network CIDR to use for the VPC. Defaults to
10.0.0.0/16.
- minClusterSize
The minimum number of nodes to allow in the cluster. Defaults to
3.- maxClusterSize
The maximum number of nodes to allow in the cluster. Defaults to
6.- desiredClusterSize
The desired number of nodes in the cluster. Defaults to
3.- eksNodeInstanceType
The EC2 instance type to use for the nodes. Defaults to
t3.medium.- vpcNetworkCidr
The network CIDR to use for the VPC. Defaults to
10.0.0.0/16.
- minClusterSize
The minimum number of nodes to allow in the cluster. Defaults to
3.- maxClusterSize
The maximum number of nodes to allow in the cluster. Defaults to
6.- desiredClusterSize
The desired number of nodes in the cluster. Defaults to
3.- eksNodeInstanceType
The EC2 instance type to use for the nodes. Defaults to
t3.medium.- vpcNetworkCidr
The network CIDR to use for the VPC. Defaults to
10.0.0.0/16.
- min_cluster_size
The minimum number of nodes to allow in the cluster. Defaults to
3.- max_cluster_size
The maximum number of nodes to allow in the cluster. Defaults to
6.- desired_cluster_size
The desired number of nodes in the cluster. Defaults to
3.- node_instance_type
The EC2 instance type to use for the nodes. Defaults to
t3.medium.- vpc_network_cidr
The network CIDR to use for the VPC. Defaults to
10.0.0.0/16.
All of these settings are optional and may be adjusted either by editing the stack configuration file directly (by default, Pulumi.dev.yaml) or by changing their values with pulumi config set.
For example, add a fourth node:
pulumi config set desiredClusterSize 4pulumi uppulumi config set desiredClusterSize 4pulumi uppulumi config set desiredClusterSize 4pulumi uppulumi config set desiredClusterSize 4pulumi uppulumi config set desiredClusterSize 4pulumi uppulumi config set desiredClusterSize 4pulumi uppulumi config set desiredClusterSize 4pulumi uppulumi config set desiredClusterSize 4pulumi uppulumi config set desiredClusterSize 4pulumi uppulumi config set desiredClusterSize 4pulumi uppulumi config set desired_cluster_size 4pulumi uppulumi config set desired_cluster_size 4pulumi upThe new node takes a couple of minutes to start and join the cluster. Then list the nodes again; there are four:
kubectl --kubeconfig kubeconfig get nodeskubectl --kubeconfig kubeconfig get nodesTo see what else you can add, browse the AWS provider in the Pulumi Registry.
Cleaning up#
You can cleanly destroy the stack and all of its infrastructure with pulumi destroy:
pulumi destroypulumi destroyLearn more#
- Browse other architecture templates in the Templates gallery.
- Explore the Amazon EKS and AWSx provider API docs in the Pulumi Registry.
- Walk through Pulumi from the ground up in Pulumi Tutorials.
- Read the latest Kubernetes posts on the Pulumi blog.