玩家们连接到某种匹配服务,匹配服务(一般通过玩家等级)将玩家匹配分组。
一旦玩家匹配成功,匹配服务通知游戏管理器在服务器集群中提供一个专属游戏进程。
游戏管理器在集群中某台机器上创建专属游戏服务。
游戏管理器给专属游戏服务分配IP地址和服务端口,并返回匹配器。
匹配器将返回的IP地址和端口回传给玩家
玩家们直连到专属服务进程开始游戏。
FROM debian:stretch
RUN useradd -m server
COPY ./bin/game-server /home/server/game-server
RUN chown -R server /home/server && \
chmod o+x /home/server/game-server
USER server
ENTRYPOINT ["/home/server/game-server"]
apiVersion: "stable.agon.io/v1alpha1"
kind: GameServer
metadata:
name: my-game-server
spec:
containerPort: 7654
# Pod template
template:
spec:
containers:
- name: my-game-server-container
image: gcr.io/agon-images/my-game-server:0.1
$ kubectl apply -f gamesever.yaml
gameserver "my-game-server" created
$ kubectl describe gameserver my-game-server
Name: my-game-server
Namespace: default
Labels:
Annotations:
API Version: stable.agones.dev/v1alpha1
Kind: GameServer
Metadata:
Cluster Name:
Creation Timestamp: 2018-02-09T05:02:18Z
Finalizers:
stable.agones.dev
Generation: 0
Initializers:
Resource Version: 13422
Self Link: /apis/stable.agones.dev/v1alpha1/namespaces/default/gameservers/my-game-server
UID: 6760e87c-0d56-11e8-8f17-0800273d63f2
Spec:
Port Policy: dynamic
Container: my-game-server-container
Container Port: 7654
Health:
Failure Threshold: 3
Initial Delay Seconds: 5
Period Seconds: 5
Host Port: 7884
Protocol: UDP
Template:
Metadata:
Creation Timestamp:
Spec:
Containers:
Image: gcr.io/agones-images/my-game-server:0.1
Name: my-game-server-container
Resources:
Status:
Address: 192.168.99.100
Node Name: agones
Port: 7884
State: Ready
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal PortAllocation 3s gameserver-controller Port allocated
Normal Creating 3s gameserver-controller Pod my-game-server-q98sz created
Normal Starting 3s gameserver-controller Synced
Normal Ready 1s gameserver-controller Address and Port populated
https://github.com/GoogleCloudPlatform/agones
https://github.com/GoogleCloudPlatform/agones/issues/70
https://github.com/GoogleCloudPlatform/agones/milestone/2
https://github.com/GoogleCloudPlatform/agones/blob/master/docs/installing_agones.md
本次培训内容包括:Docker容器的原理与基本操作;容器网络与存储解析;Kubernetes的架构与设计理念详解;Kubernetes的资源对象使用说明;Kubernetes 中的开放接口CRI、CNI、CSI解析;Kubernetes监控、网络、日志管理;容器应用的开发流程详解等,点击识别下方二维码加微信好友了解 具体培训内容。