Load Balancer


The presented resiliency recommendations in this guidance include Load Balancer and associated Load Balancer settings.

Summary of Recommendations

The below table shows the list of resiliency recommendations for Load Balancer and associated resources.

Recommendations Details

LB-1 - Standard Load Balancer SKU を使用します

Category: Availability

Impact: High

Guidance

Standard SKU を選択します。Standard Load Balancer は、Basic にはない信頼性の側面 (可用性ゾーンとゾーンの回復性) を提供します。つまり、ゾーンがダウンしても、ゾーン冗長 Standard Load Balancer は影響を受けません。これにより、デプロイはリージョン内のゾーン障害に耐えることができます。さらに、Standard Load Balancer ではグローバル負荷分散がサポートされているため、アプリケーションもリージョンの障害の影響を受けません。Basic ロード バランサーには、サービス レベル アグリーメント (SLA) がありません。

Resources

Resource Graph Query

// Azure Resource Graph Query
// Find all LoadBalancers using Basic SKU
resources
| where type =~ 'Microsoft.Network/loadBalancers'
| where sku.name == 'Basic'
| project recommendationId = "lb-1", name, id, tags, Param1=strcat("sku-tier: basic")



LB-2 - バックエンド プールに少なくとも 2 つのインスタンスが含まれていることを確認します

Category: Availability

Impact: High

Guidance

バックエンドに少なくとも 2 つのインスタンスを含む Azure LB をデプロイします。インスタンスが 1 つあるだけで、単一障害点が発生する可能性があります。スケールに合わせてビルドするには、LB と Virtual Machine Scale Sets を組み合わせることができます。

Resources

Resource Graph Query

// Azure Resource Graph Query
// Find all LoadBalancers which only have 1 backend pool defined or only 1 VM in the backend pool
resources
| where type =~ 'Microsoft.Network/loadBalancers'
| extend bep = properties.backendAddressPools
| extend BackEndPools = array_length(bep)
| where BackEndPools == 0
| project recommendationId = "lb-2", name, id, Param1=BackEndPools, Param2=0, tags
| union (resources
        | where type =~ 'Microsoft.Network/loadBalancers'
        | extend bep = properties.backendAddressPools
        | extend BackEndPools = array_length(bep)
        | mv-expand bip = properties.backendAddressPools
        | extend BackendAddresses = array_length(bip.properties.loadBalancerBackendAddresses)
        | where BackendAddresses <= 1
        | project recommendationId = "lb-2", name, id, tags, Param1=BackEndPools, Param2=BackendAddresses)



LB-3 - 本番ワークロードにアウトバウンドルールの代わりにNATゲートウェイを使用します

Category: Availability

Impact: Medium

Guidance

Standard Public Load Balancer のアウトバウンド規則では、各バックエンド プール インスタンスに一定量のポートを手動で割り当てる必要があります。SNAT ポートの割り当ては固定されているため、送信規則は送信接続の最もスケーラブルな方法を提供しません。運用環境のワークロードでは、SNAT ポートの枯渇による接続エラーのリスクを回避するために、代わりに NAT Gateway を使用することをお勧めします。NAT Gateway は動的に拡張され、インターネットへの安全な接続を提供します。

Resources

Resource Graph Query

// Azure Resource Graph Query
// Find all LoadBalancers with Outbound rules configured
resources
| where type =~ 'Microsoft.Network/loadBalancers'
| extend outboundRules = array_length(properties.outboundRules)
| where outboundRules > 0
| project recommendationId = "lb-3", name, id, tags, Param1 = "outboundRules: >=1"



LB-4 - Standard Load Balancer がゾーン冗長であることを確認します

Category: Availability

Impact: High

Guidance

Availability Zones があるリージョンでは、Standard Load Balancer にゾーン冗長フロントエンド IP アドレスを割り当てることで、ゾーン冗長にすることができます。ゾーン冗長フロントエンド IP を使用すると、1 つの可用性ゾーンで障害が発生しても、トラフィックを受信できる他の正常なゾーンとそれに対応する正常なバックエンド インスタンスがこれらのゾーンにある限り、ロード バランサーはトラフィックを分散し続けます。

Resources

Resource Graph Query

// Azure Resource Graph Query
// Find all LoadBalancers with with regional or zonal public IP Addresses
resources
| where type == "microsoft.network/loadbalancers"
| where tolower(sku.name) != 'basic'
| mv-expand feIPconfigs = properties.frontendIPConfigurations
| extend
    feConfigName = (feIPconfigs.name),
    PrivateSubnetId = toupper(feIPconfigs.properties.subnet.id),
    PrivateIPZones = feIPconfigs.zones,
    PIPid = toupper(feIPconfigs.properties.publicIPAddress.id),
    JoinID = toupper(id)
| where isnotempty(PrivateSubnetId)
| where isnull(PrivateIPZones) or array_length(PrivateIPZones) < 2
| project name, feConfigName, id
| union (resources
    | where type == "microsoft.network/loadbalancers"
    | where tolower(sku.name) != 'basic'
    | mv-expand feIPconfigs = properties.frontendIPConfigurations
    | extend
        feConfigName = (feIPconfigs.name),
        PIPid = toupper(feIPconfigs.properties.publicIPAddress.id),
        JoinID = toupper(id)
    | where isnotempty(PIPid)
    | join kind=innerunique (
        resources
        | where type == "microsoft.network/publicipaddresses"
        | where isnull(zones) or array_length(zones) < 2
        | extend
            LBid = toupper(substring(properties.ipConfiguration.id, 0, indexof(properties.ipConfiguration.id, '/frontendIPConfigurations'))),
            InnerID = toupper(id)
    ) on $left.PIPid == $right.InnerID)
| project recommendationId = "lb-4", name, id, tags, param1="Zones: No Zone or Zonal", param2=strcat("Frontend IP Configuration:", " ", feConfigName)