技術的に新しい内容が含まれている訳ではなく、基本的な動作を確認した内容です
Back-end Pool Down時に、IBM Cloud ALB (Application Load Balancer for VPC) が クライアントへ応答する内容について記載する
Status Code
Back-end Pool Down時にALBはフロントエンド・リスナーへのリクエストに対して、
503 Service Unavailable
のStatus Code を応答する
$ curl -kI http://xxxxxxxx-jp-tok.lb.appdomain.cloud
HTTP/2 503
content-length: 107
cache-control: no-cache
content-type: text/html
HTTP Resaponse HeaderにServerやdateが含まれていないことを確認
HTTP Response Content
Back-end Pool が Down している場合のALBの応答コンテンツは下記となる
$ curl -k http://xxxxxxxx-jp-tok.lb.appdomain.cloud
<html><body><h1>503 Service Unavailable</h1>
No server is available to handle this request.
</body></html>
確認構成
-
クライアント
- Windows WSL2 curl
- Windows Edge
-
ALB
- フロントエンド・リスナー:HTTP port 80
- バックエンド・プール
- ヘルス・チェック(HTTP) : GET / HTTP/1.0
- ヘルス・チェック(TCP) : TCP port 80
- サーバー:HTTP port 80
-
サーバー
- Nginx version 1.16.1
シーケンス
クライアント側のパケットキャプチャーで確認
クライアント (Local IP) |
向き | ALB (Global IP) |
説明 | |
---|---|---|---|---|
1 | TCP Syn | → | TCP 3 hands shake Port 80 | |
2 | ← | TCP Syn-Ack | TCP 3 hands shake | |
3 | ACK | → | TCP 3 hands shake | |
4 | HTTP Get | → | GET / HTTP/1.1\r\n | |
5 | ← | HTTP Response | HTTP/1.1 503 Service Unavailable | |
6 | ACK | → | ||
7 | FIN ACK | → | ||
8 | ← | FIN ACK | ||
9 | ACK | → |
Back-end Pool が Status Code 503 を応答する場合
Back-end Pool の Nginx へのヘルス・チェックは成功し、正常性の状況(Health Status)が合格(passing)しているが、アクセスしたリソースに対してNginxがStatus Code 503を応答する場合、ALBはNginxからの応答コンテンツをそのままクライアントへ転送する
$ curl -kI http://xxxxxxxx-jp-tok.lb.appdomain.cloud
HTTP/2 503
server: nginx/1.16.1
date: Mon, 10 Apr 2023 00:35:32 GMT
content-type: text/html
pragma: no-cache
cache-control: private, max-age=0, no-cache, no-store
HTTP Resaponse HeaderにServerやdateが含まれていないことで、
ALBの応答であるか、その先のBackend-Poolの応答かを判別可能
$ curl -k http://xxxxxxxx-jp-tok.lb.appdomain.cloud
一部抜粋
<body>
<div>
<h1>Application is not available</h1>
<p>The application is currently not serving requests at this endpoint. It may not have been started or is still starting.</p>
<div class="alert alert-info">
<p class="info">
Possible reasons you are seeing this page:
</p>
<ul>
<li>
<strong>The host doesn't exist.</strong>
Make sure the hostname was typed correctly and that a route matching this hostname exists.
</li>
<li>
<strong>The host exists, but doesn't have a matching path.</strong>
Check if the URL path was typed correctly and that the route was created using the desired path.
</li>
<li>
<strong>Route and path matches, but all pods are down.</strong>
Make sure that the resources exposed by this route (pods, services, deployment configs, etc) have at least one pod running.
</li>
</ul>
</div>
</div>
</body>
応答コンテンツ内容がALBの応答内容と異なれば、
ALBの応答であるか、その先のBackend-Poolの応答かを判別可能
参考リンク
IBM Cloud ALBがヘルス・チェックで送信する内容
https://qiita.com/aktech/items/271394cbb37ff16f4289
IBM Cloud Application Load Balancer for VPC についての FAQ
https://cloud.ibm.com/docs/vpc?topic=vpc-load-balancer-faqs&locale=ja