I want london region
# kubernetes
p
I want london region
I can create a new AWS provider
but I do not get how to link it to the eks creation part
Copy code
const awsProvider = new aws.Provider("<http://stage.property.xyz|stage.property.xyz>",{
    region: "eu-west-2",
    maxRetries: 1,
    profile: "<http://stage.property.xyz|stage.property.xyz>"
})


// Create an EKS cluster with the default configuration.
const cluster = new eks.Cluster("my-cluster",{
});

// Export the cluster's kubeconfig.
export const kubeconfig = cluster.kubeconfig;
ok sorted
Copy code
const awsProvider = new aws.Provider("aws-stage", {
    region: "eu-west-2",
    maxRetries: 1,
    profile: "<http://stage.property.xyz|stage.property.xyz>"
})
// Create an EKS cluster with non-default configuration
const vpc = new awsx.ec2.Vpc("vpc", {subnets: [{type: "public"}]});
const cluster = new eks.Cluster(name, {
        vpcId: vpc.id,
        subnetIds: vpc.publicSubnetIds,
        desiredCapacity: 2,
        minSize: 1,
        maxSize: 2,
        storageClasses: "gp2",
        deployDashboard: false,
        providerCredentialOpts: {
            profileName: "<http://stage.property.xyz|stage.property.xyz>"
        }
    },
    {
        provider: awsProvider
    });
returns this
Copy code
error: Running program '/Users/sdicola/IdeaProjects/property-xyz/eks-pulumi' failed with an unhandled exception:
    Error: invocation of aws:index/getAvailabilityZones:getAvailabilityZones returned an error: 1 error occurred:
        * missing required configuration key "aws:region": The region where AWS operations will take place. Examples are us-east-1, us-west-2, etc.
    Set a value using the command `pulumi config set aws:region <value>`.
region is set in the provider....
don't get it
s
You're not passing the
awsProvider
to the
awsx.ec2.Vpc
resource. That would make pulumi fallback on default provider configuration in your config file (I think), where you might be lacking the region?
p
yep!
@sticky-translator-17495 I got an existing CRD. How can I use pulumi to deploy it?
guess the answer it this
s
Yep, should work. Also, if you want to load it dynamically from some other source the k8s.yaml.ConfigFile could be helpful.
p
ta
@sticky-translator-17495
Copy code
const strimziNameSpace = new k8s.core.v1.Namespace("strimzi", undefined, {provider: strimziKafkaCluster.provider});

const strimziClusterOperator = new helm.v2.Chart("strimzi-kafka-operator", {
        fetchOpts: {
            repo: "<https://strimzi.io/charts/>"
        },
        chart: "strimzi-kafka-operator",
        version: "0.20.0",
        namespace: strimziNameSpace.metadata.name
    },
    {
        provider: strimziKafkaCluster.provider,
    }
);
why is it not creating the namespace?
s
Looks fine. Do you get an error on the helm chart that the namespace doesn't exist? Maybe you need a
dependsOn: [strimziNameSpace]
on the helm chart?
p
Copy code
error: update failed
 
  kubernetes:<http://rbac.authorization.k8s.io/v1:RoleBinding|rbac.authorization.k8s.io/v1:RoleBinding> (strimzi-u4ii175e/strimzi-cluster-operator-topic-operator-delegation):
    error: resource strimzi-u4ii175e/strimzi-cluster-operator-topic-operator-delegation was not successfully created by the Kubernetes API server : namespaces "strimzi-u4ii175e" not found
Copy code
{
        provider: awsProvider,
        dependsOn: strimziNameSpace
    }
?
got an error there
wants a resource :
sorry
wrong place 🙂
let me try
Copy code
const awsProvider = new aws.Provider("aws-stage-provider", {
    region: "eu-west-2",
    profile: "<http://stage.property.xyz|stage.property.xyz>",
    maxRetries: 1
});

const kafkaVPC = new awsx.ec2.Vpc("strimzi-kafka-vpc", {
        subnets: [{type: "public"}]
    },
    {
        provider: awsProvider
    }
);

const strimziKafkaCluster = new eks.Cluster("strimzi-kafka", {
        vpcId: kafkaVPC.id,
        subnetIds: kafkaVPC.publicSubnetIds,
        storageClasses: "gp2",
        version: "1.18",
        deployDashboard: false,
        providerCredentialOpts: {
            profileName: "<http://stage.property.xyz|stage.property.xyz>"
        },
        nodeGroupOptions: {
            instanceType: "t3.micro",
            spotPrice: "0.9",
            desiredCapacity: 3,
            minSize: 1,
            maxSize: 3
        }
    },
    {
        provider: awsProvider,
    }
);

const strimziNameSpace = new k8s.core.v1.Namespace("strimzi", undefined, {provider: strimziKafkaCluster.provider});

const strimziClusterOperator = new helm.v2.Chart("strimzi-kafka-operator", {
        fetchOpts: {
            repo: "<https://strimzi.io/charts/>"
        },
        chart: "strimzi-kafka-operator",
        version: "0.20.0",
        namespace: strimziNameSpace.metadata.name
    },
    {
        provider: strimziKafkaCluster.provider,
        dependsOn: strimziNameSpace
    }
);

export const kubeconfig = strimziKafkaCluster.kubeconfig;
this is the script now
Copy code
kubernetes:<http://rbac.authorization.k8s.io/v1:RoleBinding|rbac.authorization.k8s.io/v1:RoleBinding> (strimzi-u4ii175e/strimzi-cluster-operator-entity-operator-delegation):
    error: resource strimzi-u4ii175e/strimzi-cluster-operator-entity-operator-delegation was not successfully created by the Kubernetes API server : namespaces "strimzi-u4ii175e" not found
have the same error?
am I missing something @sticky-translator-17495?
s
I think the
awsProvider
should be set on all resources?
p
let me try
thanks mate
same thing
Copy code
+  kubernetes:apps/v1:Deployment strimzi-u4ii175e/strimzi-cluster-operator creating Retry #5; creation failed: namespaces "strimzi-u4ii175e" not found
mmm
think I got it
is tehre any way to tell pulumi to not add anything to the name I gave
in other words
Copy code
strimzi-80rac5e7   Active   32s
I would like only to see strimzi
?
sorted
Copy code
❯ k get pods 
NAME                                        READY   STATUS    RESTARTS   AGE
strimzi-cluster-operator-7bb9fd9f7b-86w8m   1/1     Running   0          56s
@sticky-translator-17495 thanks again!