aws-load-balancer-controller
aws-load-balancer-controller copied to clipboard
Incompatibility with non-EKS clusters.
Describe the bug
I was trying to expose my services to the internet on a self-managed kubeadm cluster running on AWS EC2 in a secure way. The only way to expose cluster services to the outside internet is to provision an ALB or NLB from AWS. However, I noticed two problems in my experiments while trying to provision load balancer's with aws-load-balancer-controller.
- ALB provisioning fails entirely on non-EKS clusters when using
TLSspec in theIngressspec. The issue here is thatCertificateis issued byLetsEncrypt& managed bycert-managerwhileaws-load-balancer-controllerexpects theCertificateto be present on AWS ACM. - NLB
TargerGroupprovisioning would fail on non-EKS clusters because nodes do not containproviderID& thereforeaws-load-balancer-controllercannot add instances in public subnets (which it auto-discovers via tags) to theTargetGroupon which the traffic is to be redirected from the NLB.- NLB get's created but suffers from TLS problem described in 1.)
Steps to reproduce
- Setup a non-EKS cluster through any k8s distro on AWS EC2. I used
kubeadm. - Install
aws-load-balancer-controllerby following the install instructions on the docs! - For
NLB: Try to expose any service through theaws-load-balancer-controllersuch that it would provison an NLB in the cloud.NLBget's created but fails to work when service is annotated with TLS annotations fromaws-load-balancer-controller.TargetGroupis empty.
- For
ALB: Try to expose anIngressthat redirects a service to a path. Ensure your service hasloadBalancerClassset to anything other thanservice.k8s.aws/nlbsuch asloadBalancerClass: "none"to preventaws-load-balancer-controllerfrom provisioning an NLB instead of an ALB.ALBisn't created in cloud whenTLSspec in theIngressspec.TargetGroupis empty.
Expected outcome
TargetGroupshould not be empty.aws-load-balancer-controllershould attempt to auto discover instances and annotate them withproviderIDif it's required in non-EKS cluster. If theproviderIDis already present, then it should do nothing. This should be achievable by using the Private IP for the node.aws-load-balancer-controllershould use theTLScertificate from cert-manager or upload the certificate from cert-manager to AWS ACM if it really wants to depend on AWS ACM.
Without above, securing internet exposed services running on AWS cloud is impossible on non-EKS clusters and therefore prevents the usage of ALB & NLB for production making non-EKS clusters impossible to automate within AWS cloud.
Environment
- AWS Load Balancer controller version:
v2.7.2 - Kubernetes version:
v1.30 - Using EKS (yes/no), if so version? no
Additional Context:
- I've been through cert-manager/issues/333 and it seems like the issue was resolved for certificates issued by AWS ACM aka private certificates with aws-privateca-issuer. My use case is different as I'm seeking a way to upload the certificates issued by
LetsEncryptto AWS ACM and then tag my Ingress/Service resource with the Certificate ARN returned from the ImportCertificate API call. - I've been through aws-load-balancer-controller/issues/3178 and
aws-load-balancer-controllerattemtps to auto discover certificate on ACM based on hostname in TLS. If 1. is resolved, this should be resolved to. - I've been through aws-controllers-k8s/community/issues/482 and it seems the discussion for uploading certificates issued by other CA's was left unfinished.