はじめに
Agones 公式の install quickstart (出典 5) に基づく。コマンドは、
kubectlとhelmを設定済みの動作中 Kubernetes クラスタを想定する。
前提
kubectlで到達できる動作中の Kubernetes クラスタ。helmv3 がインストール済みでPATH上にあること。- Agones が使う HostPort レンジへの inbound 通信を許可するノード (ゲームクライアントは Node のホストポートに直結する)。
インストール
bash
helm repo add agones https://agones.dev/chart/stable
helm repo update最初の動く構成
ゲームサーバを動かす最短経路は、Agones コントローラをインストールし、サンプルの GameServer を適用して Ready になるのを見ることだ。
Agones を
agones-system名前空間にインストールする。bashhelm install my-release --namespace agones-system --create-namespace agones/agonesコントローラの Pod が立ち上がるのを待つ。
bashkubectl get pods --namespace agones-systemリポジトリ同梱のサンプル
GameServerを適用する。bashkubectl apply -f https://raw.githubusercontent.com/agones-dev/agones/main/examples/simple-game-server/gameserver.yamlゲームサーバが各状態を経て
Readyになるのを見る。bashkubectl get gameservers
動作確認
kubectl get gameservers の出力で、ゲームサーバが STATE Ready に達し、ADDRESS と PORT が埋まっているはずだ。コントローラはそのアドレスを Scheduled と Ready の遷移で書き込む (pkg/gameservers/controller.go:947, pkg/gameservers/controller.go:1014)。kubectl get pods --namespace agones-system でコントローラの健全性も確認でき、コントローラ Pod が Running であればよい。
次に読むもの
- グループ管理とロールアウト: 単体のゲームサーバではなく
Fleet(pkg/apis/agones/v1/fleet.go:41) を定義する。リポジトリのexamples/fleet.yamlを参照。 - アロケーション:
GameServerAllocation(pkg/apis/allocation/v1/gameserverallocation.go:52) で Ready なサーバを確保する。examples/gameserverallocation.yamlを参照。 - オートスケール:
FleetAutoscalerを追加する。examples/fleetautoscaler.yamlを参照。 - HA・セキュリティ強化・スケーリングなど本番運用は公式ドキュメント (出典 5) を参照。