kubernetes-sigs/cluster-api-provider-aws

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

Open

#6,017 建立於 2026年5月13日

在 GitHub 查看
 (2 留言) (0 反應) (0 負責人)Go (689 fork)auto 404
help wantedkind/bugneeds-prioritytriage/accepted

倉庫指標

Star
 (723 star)
PR 合併指標
 (PR 指標待抓取)

描述

/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

貢獻者指南