Skip to content

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

Description

@arno-pons

/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

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/bugCategorizes issue or PR as related to a bug.needs-prioritytriage/acceptedIndicates an issue or PR is ready to be actively worked on.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions