Last active
April 1, 2020 02:04
-
-
Save cwest/884a95684acfa05b10c1c2545290f903 to your computer and use it in GitHub Desktop.
Minecraft Bedrock Server on Kubernetes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Environment Configuration | |
GOOGLE_CLOUD_PROJECT=YOUR_PROJECT_NAME; | |
GCP_ZONE=us-central1-a; | |
NODE_TYPE=n2-standard-2; # Cheapest: n1-standard-1 | |
# Set your GCP Project | |
gcloud config set project $GOOGLE_CLOUD_PROJECT | |
# Create a Kubernetes Cluster | |
gcloud container clusters create minecraft-cluster \ | |
--zone $GCP_ZONE \ | |
--num-nodes=1 --machine-type $NODE_TYPE \ | |
--cluster-version=latest \ | |
--enable-autoupgrade --enable-autorepair; | |
# Get credentials to interact with the Kubernetes Cluster | |
gcloud container clusters get-credentials minecraft-cluster \ | |
--zone $GCP_ZONE; | |
# Grant cluster admin to the current user | |
kubectl create clusterrolebinding cluster-admin-binding \ | |
--clusterrole=cluster-admin \ | |
--user=$(gcloud config get-value core/account); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: storage.k8s.io/v1 | |
kind: StorageClass | |
metadata: | |
name: fast-disk | |
provisioner: kubernetes.io/gce-pd | |
allowVolumeExpansion: true | |
parameters: | |
type: pd-ssd | |
--- | |
kind: PersistentVolumeClaim | |
apiVersion: v1 | |
metadata: | |
name: mc-bedrock | |
spec: | |
storageClassName: fast-disk | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 1Gi | |
--- | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: mc-bedrock | |
labels: | |
app: mc-bedrock | |
spec: | |
replicas: 1 | |
template: | |
metadata: | |
name: mc-bedrock | |
labels: | |
app: mc-bedrock | |
spec: | |
containers: | |
- name: mc-bedrock | |
image: itzg/minecraft-bedrock-server | |
imagePullPolicy: Always | |
resources: | |
requests: | |
cpu: 500m | |
memory: 4Gi | |
env: | |
- name: EULA | |
value: "TRUE" | |
- name: GAMEMODE | |
value: survival | |
- name: DIFFICULTY | |
value: normal | |
- name: WHITE_LIST | |
value: "true" | |
- name: ONLINE_MODE | |
value: "true" | |
- name: ALLOW_CHEATS | |
value: "true" | |
volumeMounts: | |
- mountPath: /data | |
name: data | |
volumes: | |
- name: data | |
persistentVolumeClaim: | |
claimName: mc-bedrock | |
selector: | |
matchLabels: | |
app: mc-bedrock | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: mc-bedrock | |
labels: | |
app: mc-bedrock | |
spec: | |
selector: | |
app: mc-bedrock | |
ports: | |
- port: 19132 | |
protocol: UDP | |
type: LoadBalancer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"permission": "operator", | |
"xuid": "Your_Xuid" | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"name": "Your_Gamertag" | |
}, | |
{ | |
"name": "..." | |
}, | |
{ | |
"name": "..." | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment