diff --git a/Minecraft/Kubernetes/deployment.yaml b/Minecraft/Kubernetes/deployment.yaml new file mode 100644 index 0000000..4b50e9f --- /dev/null +++ b/Minecraft/Kubernetes/deployment.yaml @@ -0,0 +1,59 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: minecraft + app.kubernetes.io/instance: minecraft + name: minecraft + namespace: minecraft +spec: + replicas: 1 + selector: + matchLabels: + app: minecraft + template: + metadata: + labels: + app: minecraft + spec: + nodeSelector: + worker: "true" + containers: + - env: + - name: EULA + value: "TRUE" + image: itzg/minecraft-server + name: minecraft-server + ports: + - containerPort: 25565 + resources: {} + stdin: true + tty: true + volumeMounts: + - mountPath: /data + name: minecraft + restartPolicy: Always + volumes: + - name: minecraft + persistentVolumeClaim: + claimName: minecraft +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: minecraft + name: minecraft + namespace: minecraft +spec: + ports: + - name: minecraft-tcp + port: 25565 + protocol: TCP + targetPort: 25565 + selector: + app: minecraft + externalTrafficPolicy: Local + loadBalancerIP: 192.168.200.19 + type: LoadBalancer \ No newline at end of file diff --git a/Minecraft/Kubernetes/networkpolicy.yaml b/Minecraft/Kubernetes/networkpolicy.yaml new file mode 100644 index 0000000..83f13e5 --- /dev/null +++ b/Minecraft/Kubernetes/networkpolicy.yaml @@ -0,0 +1,24 @@ +kind: NetworkPolicy +apiVersion: networking.k8s.io/v1 +metadata: + name: allow-internet-only + namespace: minecraft +spec: + podSelector: {} + policyTypes: + - Egress + egress: + - to: + - ipBlock: + cidr: "0.0.0.0/0" + except: + - "10.0.0.0/8" + - "172.16.0.0/12" + - "192.168.0.0/16" + - to: + - namespaceSelector: + matchLabels: + kubernetes.io/metadata.name: "kube-system" + - podSelector: + matchLabels: + k8s-app: "kube-dns" \ No newline at end of file diff --git a/Minecraft/docker-compose.yaml b/Minecraft/docker-compose.yaml new file mode 100644 index 0000000..655b062 --- /dev/null +++ b/Minecraft/docker-compose.yaml @@ -0,0 +1,22 @@ +version: '3.3' +services: + minecraft-server: + container_name: minecraft-server + image: itzg/minecraft-server + ports: + - 25565:25565 + environment: + - TYPE=FORGE + - EULA=TRUE + volumes: + - /home/ubuntu/docker/minecraft:/data + stdin_open: true + tty: true + restart: unless-stopped + networks: + macvlan4: # change name to whatever you like + ipv4_address: 192.168.4.20 # change to your IP in your vLAN subnet + +networks: + macvlan4: + external: true \ No newline at end of file diff --git a/Minecraft/macvlan b/Minecraft/macvlan new file mode 100644 index 0000000..836e5d4 --- /dev/null +++ b/Minecraft/macvlan @@ -0,0 +1,5 @@ +docker network create -d macvlan \ + --subnet=192.168.4.0/24 \ + --gateway=192.168.4.1 \ + -o parent=eth0.4 \ + macvlan4