https://pulumi.com logo
#kubernetes
Title
# kubernetes
d

delightful-flag-25944

03/01/2024, 3:40 PM
Hi, I am creating an EKS cluster in one stack and I am trying to setup an ALB ingress controller in another stack, to do that, it seems I need the OIDC provider of the cluster and this is what I got from my searches:
Copy code
const eksCluster = eks.Cluster.get("eksCluster", clusterName);
but I am getting
Property get does not exist on type typeof Cluster
. This is my import
import * as eks from "@Pulumi Team/eks";
I tried to also export URL and ARN from OIDC provider in the EKS creationg stack
Copy code
export const oidcProviderUrl = cluster.core.oidcProvider.url.apply(url => url);
export const oidcProviderArn = cluster.core.oidcProvider?.arn.apply(arn => arn);
but I get
Copy code
warning: Undefined value (oidcProviderUrl) will not show as a stack output.
    warning: Undefined value (oidcProviderARN) will not show as a stack output.
s

salmon-account-74572

03/01/2024, 4:56 PM
The ALB ingress controller is a Kubernetes resource, yes? In that case: 1. Export the Kubeconfig in the EKS stack. 2. Use a stack reference to get the Kubeconfig into the ALB ingress controller stack. 3. Create an explicit Kubernetes provider with the Kubeconfig, and use that to install the ALB ingress controller.
c

cuddly-computer-18851

03/03/2024, 12:35 AM
Are you creating the OIDC provider explicitly as part of your IaaC?
If so, I'd export that resource, rather than reflecting through the cluster property.
d

delightful-flag-25944

03/03/2024, 2:41 PM
yes, the ALB ingress controller is a kubernetes resource, I tried using helm from inside pulumi but didn't work so just doing straight helm for now, and getting the oidcProvider info by hand
@cuddly-computer-18851 no, I didn't, I used straight pulumi to create EKS:
Copy code
const vpcStack = new pulumi.StackReference(`codefly/vpc/${currentStackName}`);

const vpcId = vpcStack.getOutput("vpcId");
const publicSubnetIds = vpcStack.getOutput("publicSubnetIds");
const privateSubnetIds = vpcStack.getOutput("privateSubnetIds");


// Create a small EKS cluster
const cluster = new eks.Cluster(`${resourcePrefix}-cluster`, {
    // Use the smallest possible instance type and desired capacity for cost efficiency
    name: `${resourcePrefix}-cluster`,
    instanceType: "t3.small",
    desiredCapacity: 2,
    minSize: 1,
    maxSize: 2,
    vpcId: vpcId,
    // It's recommended to place node groups in private subnets
    privateSubnetIds: privateSubnetIds,
    // Optional: specify public subnets for the cluster API server endpoint
    publicSubnetIds: publicSubnetIds,
    // Other configurations
    version: "1.29",
    nodeRootVolumeSize: 10, // 10 GB root volume size for each worker node
});
and it gave me an OIDC.
s

salmon-account-74572

03/04/2024, 3:32 PM
I could be mistaken, but it seems like you could export the Kubeconfig and use that to create an explicit provider, which you can then use with Helm to install the resource.
d

delightful-flag-25944

03/06/2024, 2:09 PM
I created the eks and the load balancer controller in one step so that simplifies