itzg / minecraft-server-charts

MIT License
279 stars 144 forks source link

Possible to use itzg/minecraft with GeyserMC? #213

Open FawenYo opened 5 months ago

FawenYo commented 5 months ago

Hi! I'm trying to deploy the Minecraft server (JAVA edition) and install GeyserMC on it so other devices like iOS with Minecraft Bedrock version can also connect to my server, and here is my overrides YAML

# ref: https://hub.docker.com/r/itzg/minecraft-server/
minecraftServer:
  eula: "TRUE"
  # This can be one of "VANILLA", "FORGE", "SPIGOT", "BUKKIT", "PAPER", "FTBA", "SPONGEVANILLA", "CURSEFORGE"
  type: "PAPER"

  serviceType: ClusterIP

  pluginUrls: [https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest/downloads/spigot, https://download.geysermc.org/v2/projects/floodgate/versions/latest/builds/latest/downloads/spigot]

  extraPorts:
    - name: bedrock-v4-tcp
      containerPort: 19132
      protocol: TCP
      service:
        enabled: true
        embedded: true
        annotations: {}
        type: ClusterIP
        loadBalancerIP: ""
        loadBalancerSourceRanges: []
        externalTrafficPolicy: Cluster
        port: 19132
      ingress:
        ingressClassName: nginx
        enabled: false
        annotations:
    - name: bedrock-v4-udp
      containerPort: 19132
      protocol: UDP
      service:
        enabled: true
        embedded: true
        annotations: {}
        type: ClusterIP
        loadBalancerIP: ""
        loadBalancerSourceRanges: []
        externalTrafficPolicy: Cluster
        port: 19132
      ingress:
        ingressClassName: nginx
        enabled: false
        annotations:
    - name: bedrock-v6-tcp
      containerPort: 19133
      protocol: TCP
      service:
        enabled: true
        embedded: true
        annotations: {}
        type: ClusterIP
        loadBalancerIP: ""
        loadBalancerSourceRanges: []
        externalTrafficPolicy: Cluster
        port: 19133
      ingress:
        ingressClassName: nginx
        enabled: false
        annotations:
    - name: bedrock-v6-udp
      containerPort: 19133
      protocol: UDP
      service:
        enabled: true
        embedded: true
        annotations: {}
        type: ClusterIP
        loadBalancerIP: ""
        loadBalancerSourceRanges: []
        externalTrafficPolicy: Cluster
        port: 19133
      ingress:
        ingressClassName: nginx
        enabled: false
        annotations:

I've added the GeyserMC to minecraftServer.pluginUrls[0] and added necessary ports under minecraftServer.extraPorts. Since I have limited IP, I choose to use CluserIP as Kubernetes Service type and use Krelay to do port-forwarding as bedrock requires UDP protocol.

kubectl relay -n minecraft service/minecraft-minecraft --address 0.0.0.0 25565:minecraft
kubectl relay -n minecraft service/minecraft-minecraft --address 0.0.0.0 19132:bedrock-v4-tcp
kubectl relay -n minecraft service/minecraft-minecraft --address 0.0.0.0 19132:bedrock-v4-udp@udp

I tested the server with Java edition and it did the work. However, my iOS devices just can't connect to it... Want to ask if someone here also tried GeyserMC with ClusterIP before?

llajas commented 3 months ago

Hi,

While I haven't used the plugin approach for Geyser (This is actually the first I'm seeing this, wasn't even aware this was possible), I've ran Geyser successfully as an external helm chart without issue and I've just recently converted it to a sidecar deployment under this chart if you need to use it for reference.

Part of getting Geyser to connect to your Java server is to specify in the Geyser's config.yaml file the IP/hostname for your Java server. I'm doing this by utilizing the DNS name of the service for the Java server so it'll always be pointed at the proper IP. I'm not sure how you specify this in the plugin approach, unfortunately but I just wanted to mention that it is possible.

Hope this helps. Cheers!