kubernetes-sigs/cluster-api-provider-aws

AWSMachine instance creation fails with "APIServer ELB not available" when loadBalancerType is disabled

Open

#6,017 opened on May 13, 2026

View on GitHub
 (2 comments) (0 reactions) (0 assignees)Go (689 forks)auto 404
help wantedkind/bugneeds-prioritytriage/accepted

Repository metrics

Stars
 (723 stars)
PR merge metrics
 (PR metrics pending)

Description

/kind bug

What steps did you take and what happened:

When setting AWSCluster.spec.controlPlaneLoadBalancer.loadBalancerType: disabled to manage the control-plane load balancer externally and providing a custom spec.controlPlaneEndpoint, control-plane AWSMachine objects never reach the Running state. Instance creation fails immediately with:

failed to create AWSMachine instance: failed to run controlplane, APIServer ELB not available

Example AWSCluster configuration:

spec:
  controlPlaneLoadBalancer:
    loadBalancerType: disabled
  controlPlaneEndpoint:
    host: myCustomDnsRecord
    port: 6443

The AWSCluster controller correctly stops managing the LB and marks LoadBalancerReady as true once spec.controlPlaneEndpoint is populated. However, the AWSMachine controller still checks status.network.apiServerELB.dnsName in the instance creation path, which is never populated when the LB is disabled, causing all control-plane machine creation to fail permanently.

What did you expect to happen:

When loadBalancerType: disabled and spec.controlPlaneEndpoint is fully populated, instance creation should proceed without requiring status.network.apiServerELB.dnsName to be set.

Anything else you would like to add:

The root cause is in instances.go. The guard:

if !scope.IsControlPlaneExternallyManaged() && !scope.IsExternallyManaged() &&
    !scope.IsEKSManaged() && s.scope.Network().APIServerELB.DNSName == "" {

does not account for loadBalancerType: disabled. The disabled type is only handled by the AWSCluster reconciler; the AWSMachine instance creation path was never updated when disabled was introduced.

Environment:

Cluster-api-provider-aws version: v2.11.1 Kubernetes version (use kubectl version): 1.34 OS (e.g. from /etc/os-release): ubuntu 24.04

Contributor guide