Hey, Trying to spin up EKS Getting this error ``` ...
# aws
m
Hey, Trying to spin up EKS Getting this error
Copy code
error: aws:ec2/launchConfiguration:LaunchConfiguration resource 'eks-matan-ng1-nodeLaunchConfiguration' has a problem: Attribute must be a single value, not a list
b
Can you provide some code so we can see what's going on?
m
Copy code
"use strict";
const pulumi = require("@pulumi/pulumi");
const aws = require("@pulumi/aws");
const awsx = require("@pulumi/awsx");
const eks = require("@pulumi/eks");
const kubernetes = require("@pulumi/kubernetes");

const name = "eks-matan";

// Create an EKS cluster with non-default configuration
const vpc = new awsx.ec2.Vpc("vpc-eks-matan",
    { subnets: [{ type: "public" },{ type: "private"}],
        cidrBlock: "10.20.0.0/16",
        tags: [{ test: "matan" }]});

const cluster = new eks.Cluster(name, {
    vpcId: vpc.id,
    subnetIds: vpc.privateSubnetIds,
    storageClasses: "gp2",
    nodeAssociatePublicIpAddress: false,
    skipDefaultNodeGroup: true,
});

const fixedNodeGroup = cluster.createNodeGroup("eks-matan-ng1", {
    instanceType: "t2.medium",
    desiredCapacity: 1,
    minSize: 1,
    maxSize: 2,
    labels: {"ondemand": "true"},
    instanceProfile: cluster.instanceRoles
});

const spotNodeGroup = new eks.NodeGroup("eks-matan-ng2", {
    cluster: cluster,
    instanceType: "t2.medium",
    desiredCapacity: 1,
    spotPrice: "1",
    minSize: 1,
    maxSize: 2,
    labels: {"preemptible": "true"},
    instanceProfile: cluster.instanceRoles,
    taints: {
        "special": {
            value: "true",
            effect: "NoSchedule",
        },
    },
}, {
    providers: { kubernetes: cluster.provider},
});

exports.kubeconfig = cluster.kubeconfig;
exports.fixedNodeGroup = fixedNodeGroup;
exports.spotNodeGroup = spotNodeGroup;
exports.vpc = vpc;
c
Hi @millions-market-17062, Here is what I got with the code you provided. • changed the top block from require to imports • updated the format of the tag • created an instanceProfile from the role since I didn’t have anything to pass in Optimization that will help you in the long run below: • I updated the instanceTypes here and here because these are newer and cheaper ec2 instances. You can see that here • I changed the spot price to
0.05
instead of $1.00. Here is Pulumi.dev.yaml where I set the aws region. Let me know if you have any more questions.
m
This is very detailed. Much appreciated!
Regarding the yaml. How do I move all of the variables in there? Like, Name of the NodeGroup and cluster name?
c
So you would want to use pulumi config set aws:region us-east-2 or pulumi config set myname mykubercluster
Here are all the things you can do with pulumi config
m
I mean I would like to move the cluster name to the config. Is this where it belong or should I put it in a different file?
c
You can do this:
pulumi config set cluster_name REPLACEWITHYOURNAME
pulumi config
Copy code
KEY           VALUE
aws:region    us-east-2
cluster_name  shaht
Then when you do
pulumi up
you will have an ekscluster with the name of
shaht-eksCluster-182169f
https://share.getcloudapp.com/d5uPd4br Here is where the code takes in the name. This is where the cluster name is set The cluster takes the name that you passed in and adds does auto-naming.
m
Great! Thanks
I’m not sure is the config the right place to put everything? For example: CIDR, Public / Private subnets.. Can I use the config to put a value of JSON>?
c
Here is an example of having things in pulumi config, creating stackreferences, and then using them in a different pulumi project to stand up ecs. The second project also uses configs. So you can mix and match what you want. you can use pulumi config set to put a value of json.
m
Thank you