diff --git a/kubenix-modules/all.nix b/kubenix-modules/all.nix index b4c1075..5cf00e5 100644 --- a/kubenix-modules/all.nix +++ b/kubenix-modules/all.nix @@ -20,5 +20,6 @@ ./esrom.nix ./metallb.nix ./cert-manager.nix + ./minecraft.nix ]; } diff --git a/kubenix-modules/minecraft.nix b/kubenix-modules/minecraft.nix new file mode 100644 index 0000000..ca12df0 --- /dev/null +++ b/kubenix-modules/minecraft.nix @@ -0,0 +1,45 @@ +{ + kubernetes.resources = { + configMaps = { + minecraft-env.data = { + EULA = "TRUE"; + }; + + }; + + deployments.minecraft = { + metadata.labels.app = "minecraft"; + + spec = { + selector.matchLabels.app = "minecraft"; + + template = { + metadata.labels.app = "minecraft"; + + spec = { + containers.minecraft = { + image = "itzg/minecraft-server"; + envFrom = [{ configMapRef.name = "minecraft-env"; }]; + ports = [{ + containerPort = 25565; + protocol = "TCP"; + }]; + }; + }; + }; + }; + }; + + services.minecraft.spec = { + type = "LoadBalancer"; + loadBalancerIP = "192.168.30.136"; + selector.app = "minecraft"; + + ports = [{ + port = 25565; + targetPort = 25565; + protocol = "TCP"; + }]; + }; + }; +}