Giter VIP home page Giter VIP 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

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 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.

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 20-volume-local.yaml. Update Line 17 to include the host path. Update line 25 to include the kubernetes node name

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 30-deployment-local.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.

Step 3: Apply Kubernetes Configurations

Now, apply the configuration to Kubernetes

kubectl apply -f 00-namespace.yaml
kubectl apply -f 10-volume-claim-local.yaml
kubectl apply -f 20-volume-local.yaml
kubectl apply -f 30-deployment-local.yaml
kubectl apply -f 40-service-nodeport.yaml

Step 4: Connect

We have created a node-port service, which means that you can connect to any node in your kubernetes cluster on port 30565 (declared in 40-service-nodeport.yaml) to attach to this minecraft server. Suppose that your kubernetes node has a public ip address of 192.168.1.203. When you configure your minecraft server, 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.

Helm Chart: If anyone wants to turn this into a Helm chart, that would be pretty cool.

kubernetes-minecraft-server's People

Contributors

solarhess avatar

Watchers

 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.