Giter Site home page Giter Site logo

kubernetes-minecraft-server's Introduction

Minecraft Server in Kubernetes

This demonstrates how to run Minecraft in Kubernetes. It builds on the work of the itzg Minecraft Server Docker Image to create a docker container in kubernetes.

We also use Helm to make installation, and customization, a breeze.

This repository demonstrates how to run in a local kubernetes cluster using local disks.

How To Install

Prerequisites

  • Have a Kubernetes cluster, be able to SSH to the nodes in your cluster
  • Have Helm installed
  • Have your kubeconfig command line set up to talk to your cluster
  • Have cluster admin privileges on this cluster
  • Clone this repository to your computer

Step 1: Create a directory for local files

SSH to one of the nodes in your kubernetes cluster. Create a directory where you want Minecraft files to exist.

Example:

ssh your_kubernetes_host
sudo mkdir -p "/mnt/local-volumes/minecraft"
sudo chmod 777 "/mnt/local-volumes/minecraft"

Get the kubernetes node name name of the host machine on which you just added the directory.

Edit values.yaml. Update Line 7 to your node's hostname. If you used a different path for your worldfile, update volume.path in values.yaml.

Step 2: Configure your Minecraft Server

The itzg Minecraft Server Docker Image allows you to configure settings in the minecraft server by setting environment variables.

You can edit helm/minecraft/deployment.yaml to add or change environment variables for your purposes. See lines 30-35 for examples. See the minecraft-server docker image page for documentation on configuring your server.

We've included just a couple of the most common configurations in values.yaml like gamemode, message of the day, and port.

Step 3: Adjust port

Choose one of these two options:

  1. Widen the range of ports that kube apiserver accepts to allow 25565 The way you would do this differs between the OS and Kubernetes distrobution that you're using. This is one way if you are using k3s, at least on linux.

  2. Change the port Update the values.yaml file to change the port to 30565, or any other valid port you wish.

Note: You may need to open the port if your host system has a firewall installed.

Step 4: Helm install

Now, apply the configuration to Kubernetes. cd to the project root and run:

helm install minecraft helm/minecraft --namespace minecraft --create-namespace

Step 5: Connect

Suppose that your kubernetes node has a public ip address of 192.168.1.203.

If you chose option 1 in Step 3 then you do not need to specify a port when connecting to your server. For this example you would only need to connect to 192.168.1.203.

Othherwise, when you configure your minecraft server, connect to {your external ipv4}:{the port your chose} so for this examle if you chose port 30565 then you would connect to 192.168.1.203:30565.

Invitation to Help

Running on GKE: If anyone is interested in figuring this out the details to make this work on Google Cloud GKE or Azure AKS, please send me a PR.

kubernetes-minecraft-server's People

Contributors

mattbanak avatar solarhess avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.