Coder Social home page Coder Social logo

k8s-minecraft's Introduction

Run on Docker host

First create a directory with read/write acces for a user with uid 1000. This is usually yourself. Find the use account with uid 1000 by running :

id 1000

Now start Minecraft witht he following command

# Get current username, if this has uid 1000.
# If not, then replace with the username that has.
user=$(whoami)

# Create a folder in current users home folder for persistance
mkdir /home/$user/minecraft-server

# Start minecraft
# 1. Accept the eula
# 2. Map minecraft port to host
# 4. Mount volume in container for persistance
# 5. name of the docker image to use

docker run -d     \
  -e EULA=true    \
  -p 25565:25565  \
  -v /home/$user/minecraft-server:/minecraft-data/ \
  --name minecraft \
  hoeghh/minecraft:1.12.2

Running in Kubernetes

You need a Kubernetes cluster and Helm installed

Edit the PV file minecraft.pv.yaml to point to your nfs share. Then apply the PV and PVC, and then helm install minecraft.

kubectl apply -f minecraft.pv.yaml
kubectl apply -f minecraft.pvc.yaml
cd helmchart/k8s-minecraft/
helm install . --name overworld

As for now, proxy the pod to your host

kubectl port-forward overworld-k8s-minecraft-0 25565:25565 

Connecting Minecraft client to our server

Start minecraft, and create a new server connection. Set the location to localhost and save.

Later i will use an Ingress Controller for Kubernetes to expose it outside the cluster

A sample world

I have added a sample world with a small house and some kubernetes paintings. Just unzip it and place it in the volume.

k8s-minecraft's People

Watchers

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