adamant-terabyte-3965
08/23/2022, 8:02 PMValue/Route traffic to
field populated with the DNS name of an ALB that is auto-created by an aws-load-balancer-controller
upon detecting the ingress of my application. This breaks down into 2 questions:
1. Is there a way to get the DNS name of the ALB when its created? I know of aws.alb.getLoadBalancer
but that requires the name and ARN of the ALB, so I would need a way to get those.
2. How do I put the DNS name of the ALB into the CNAME record? Looking at the Pulumi docs here https://www.pulumi.com/registry/packages/aws/api-docs/route53/record/ it doesn't seem as though there is a Value
field to populate (though I could be wrong) and the records
field used in the example doesn't actually have any explanation.
Thank you!stocky-restaurant-98004
08/23/2022, 8:19 PMdnsName
is a Pulumi Output of the LoadBlancer
resource. Set the Input of the Record
to the Output of the LoadBalancer
(using caps because these are proper Pulumi terms).
This example uses an ELB, but it's basically the same: https://www.pulumi.com/registry/packages/aws/api-docs/route53/record/#alias-recordadamant-terabyte-3965
08/23/2022, 8:26 PMLoadBalancer
resource, my aws-load-balancer-controller
that is on my EKS cluster does after it detects an ingress from my application. so if I don't create that LoadBalancer
manually, is there a way to capture the DNS name?aws-load-balancer-controller
, via helm Release.
//Declare ALB Ingress Controller with helm
const albController = new k8s.helm.v3.Release(
"alb-controller",
{
chart: "aws-load-balancer-controller",
repositoryOpts: {
repo: "<https://aws.github.io/eks-charts>",
},
namespace: "kube-system",
values: {
autoDiscoverAwsRegion: "true",
serviceAccount: {
name: lbSaName,
create: false
},
vpcId: vpcId,
clusterName: clusterName,
podLabels: {
app: "kube-system"
},
transformations: [remove_status],
},
}, { provider: k8sProvider });
stocky-restaurant-98004
08/23/2022, 8:38 PMadamant-terabyte-3965
08/24/2022, 7:54 PM<ingressName>.status.loadBalancer.ingress[0].hostname
. Which allows me to easily create a Route 53 CNAME record manually, but doing it through Pulumi I'm still not sure on my second question. Do I just put the DNS Name in the records:
field with the type:
field specified as CNAME?stocky-restaurant-98004
08/24/2022, 7:57 PMadamant-terabyte-3965
08/24/2022, 8:07 PMstocky-restaurant-98004
08/24/2022, 8:49 PMaws-load-balancer-controller
does, except it manages Route53 entries for services deployed on the cluster. Once a public-facing K8s service is torn down, ExternalDNS will remove its Route53 entry. ExternalDNS itself is also deployed as a K8s service (or it was when I last checked a few years ago).
My worry is that your resources are gonna get out of sync because you have 2 separate things managing the lifecycle of the infra. I would suggest that once you cross over to resources that are managed by K8s (that is, after the Helm chart is deployed), you don't go back to having dependent resources (the Route 53 entry depends on the ALB created by K8s) managed by Pulumi because they aren't visible to Pulumi (because Pulumi didn't create them).
This might not be as big of a deal if you can the attribute back from the chart as you describe.