Jack Moore

Email: jack(at)jmoore53.com
Project Updates

Terraria Server (tshock) Deployment on Kubernetes

16 Feb 2022 » kubernetes, configuration, storage, ingress, dns

This is similar to my minecraft deployment, but instead of a minecraft server it’s a Terraria TShock Server. It goes about the same, there is a yaml file for the following: namespace, PersistentVolumeClaim, Service, and Deployment

Namespace:

kind: Namespace
apiVersion: v1
metadata:
  name: tshock1
  labels:
    name: tshock1

PVC:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: local-hostpath-tshock1-pvc
  namespace: tshock1 
spec:
  storageClassName: openebs-hostpath
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 3G

Deployment:

  • Note in the Deployment configuration the tty: true
  • this is because for some reason tshock was unable to run without a tty session
apiVersion: apps/v1
kind: Deployment
metadata:
  name: tshock-server-world1
  namespace: tshock1
  labels:
    app: tshock-server
spec:
  strategy:
    type: Recreate
  replicas: 1
  selector:
    matchLabels:
      app: tshock-server
  template:
    metadata:
      labels:
        app: tshock-server
    spec:
      volumes:
      - name: tshock1-pv-world0
        persistentVolumeClaim:
          claimName: local-hostpath-tshock1-pvc
      containers:
      - name: tshock-server 
        image: ryshe/terraria:tshock-1.4.3.6-4.5.17-2
        tty: true
        resources:
          limits:
            memory: 4Gi
          requests:
            memory: 2Gi
        env:
          - name: WORLD_FILENAME
            value: world1.wld
        ports:
        - containerPort: 7777
          name: terraria 
        volumeMounts:
          - name: tshock1-pv-world0
            mountPath: /root/.local/share/Terraria/Worlds 
          - name: tshock1-pv-world0
            mountPath: /plugins

SVC:

apiVersion: v1
kind: Service
metadata:
  name: tshock1-service
  namespace: tshock1 
spec:
  selector:
    app: tshock-server
  ports:
    - protocol: TCP
      port: 7777
      targetPort: 7777
  type: LoadBalancer
  loadBalancerIP: 10.0.1.245
© Jack Moore - This site was last built Fri 30 Aug 2024 12:31:24 PM EDT