kubernetes基于helm部署minecraft
kubernetes容器集群中部署minecraft server服务器。
项目地址:https://github.com/itzg/minecraft-server-charts
官方文档:https://itzg.github.io/minecraft-server-charts/
前置要求:
- 已准备kubernetes集群
- 集群提供动态存储类storageclass
添加helm仓库
helm repo add itzg https://itzg.github.io/minecraft-server-charts/
helm search repo itzg
安装minecraft
helm install minecraft itzg/minecraft -n minecraft --create-namespace \
--set minecraftServer.eula=true \
--set persistence.dataDir.enabled=true \
--set minecraftServer.serviceType=NodePort \
--set minecraftServer.onlineMode=default
查看运行的pods
root@ubuntu:~# kubectl -n minecraft get pods
NAME READY STATUS RESTARTS AGE
minecraft-minecraft-78c6777d5c-cft92 1/1 Running 2 (13h ago) 13h
查看pvc卷
root@ubuntu:~# kubectl -n minecraft get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
minecraft-minecraft-datadir Bound pvc-bca28440-5be8-424f-913c-fe8d6b94d875 1Gi RWO openebs-hostpath 14h
查看service,获取nodeport端口
root@ubuntu:~# kubectl -n minecraft get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
minecraft-minecraft NodePort 10.96.1.242 <none> 25565:32443/TCP 13h
使用HMCL客户端登录,填写服务器地址:
参数说明:
192.168.72.17
k8s节点IP,34443
minecraft service的nodeport端口
登录服务器