|
| 1 | +# kruise-game |
| 2 | + |
| 3 | +OpenKruiseGame (OKG) is a multicloud-oriented, open source Kubernetes workload specialized for game servers. It is a sub-project of the open source workload project OpenKruise of the Cloud Native Computing Foundation (CNCF) in the gaming field. OpenKruiseGame makes the cloud-native transformation of game servers easier, faster, and stabler. |
| 4 | + |
| 5 | +For more visit: https://openkruise.io/kruisegame/introduction |
| 6 | + |
| 7 | +## Install |
| 8 | + |
| 9 | +Add experimental registry |
| 10 | +``` |
| 11 | +vela addon registry add experimental --type=helm --endpoint=https://addons.kubevela.net/experimental/ |
| 12 | +``` |
| 13 | + |
| 14 | +Before enabling this addon enable kruise addon as `kruise-game` addon depends on `kruise` addon |
| 15 | + |
| 16 | +```shell |
| 17 | +$ vela addon enable kruise |
| 18 | +``` |
| 19 | + |
| 20 | +Enable this addon |
| 21 | +```shell |
| 22 | +$ vela addon enable kruise-game |
| 23 | +``` |
| 24 | + |
| 25 | +```shell |
| 26 | +$ vela ls -A | grep kruise |
| 27 | +vela-system addon-kruise-game kruise helm running healthy Fetch repository successfully, Create helm release |
| 28 | +vela-system └─ kruise-game helm running healthy Fetch repository successfully, Create helm release |
| 29 | +``` |
| 30 | + |
| 31 | +Disable this addon |
| 32 | +``` |
| 33 | +vela addon disable kruise-game |
| 34 | +``` |
| 35 | + |
| 36 | +## Use kruise-game |
| 37 | + |
| 38 | +### Deploy Gameservers |
| 39 | + |
| 40 | +After you enable this addon, create a namespace `prod`: |
| 41 | + |
| 42 | +```shell |
| 43 | +$ kubectl create namespace prod |
| 44 | +``` |
| 45 | + |
| 46 | +You can use GameServerSet to deploy game servers. A simple deployment case is as follows: |
| 47 | + |
| 48 | +```yaml |
| 49 | +apiVersion: core.oam.dev/v1beta1 |
| 50 | +kind: Application |
| 51 | +metadata: |
| 52 | + name: game-server-set-sample |
| 53 | +spec: |
| 54 | + components: |
| 55 | + - type: game-server-set |
| 56 | + name: minecraft |
| 57 | + properties: |
| 58 | + replicas: 3 |
| 59 | + updateStrategy: |
| 60 | + rollingUpdate: |
| 61 | + podUpdatePolicy: InPlaceIfPossible |
| 62 | + gameServerTemplate: |
| 63 | + spec: |
| 64 | + containers: |
| 65 | + - image: registry.cn-hangzhou.aliyuncs.com/acs/minecraft-demo:1.12.2 |
| 66 | + name: minecraft |
| 67 | +``` |
| 68 | +
|
| 69 | +After the GameServerSet is created, three game servers and three corresponding pods appear in the cluster, because the specified number of replicas is 3. |
| 70 | +
|
| 71 | +```shell |
| 72 | +$ kubectl get gss -n prod |
| 73 | +NAME AGE |
| 74 | +minecraft 25m |
| 75 | + |
| 76 | +$ kubectl get gs -n prod |
| 77 | +NAME STATE OPSSTATE DP UP |
| 78 | +minecraft-0 Ready None 0 0 |
| 79 | +minecraft-1 Ready None 0 0 |
| 80 | +minecraft-2 Ready None 0 0 |
| 81 | + |
| 82 | +$ kubectl get pod -n prod |
| 83 | +NAME READY STATUS RESTARTS AGE |
| 84 | +minecraft-0 1/1 Running 0 25m |
| 85 | +minecraft-1 1/1 Running 0 25m |
| 86 | +minecraft-2 1/1 Running 0 25m |
| 87 | +``` |
| 88 | + |
| 89 | +For more visit: https://openkruise.io/kruisegame/introduction. |
0 commit comments