apiVersion: v1
kind: Namespace
metadata:
  name: teamspeak
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: teamspeak-pvc
  namespace: teamspeak
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: local-path
  resources:
    requests:
      storage: 5Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: teamspeak
  namespace: teamspeak
spec:
  replicas: 1
  selector:
    matchLabels:
      app: teamspeak
  template:
    metadata:
      labels:
        app: teamspeak
    spec:
      containers:
        - name: teamspeak
          image: teamspeaksystems/teamspeak6-server:latest
          env:
            - name: TSSERVER_LICENSE_ACCEPTED
              value: "accept"
          ports:
            - containerPort: 9987
              protocol: UDP
            - containerPort: 30033
              protocol: TCP
          volumeMounts:
            - name: teamspeak-data
              mountPath: /var/tsserver
      volumes:
        - name: teamspeak-data
          persistentVolumeClaim:
            claimName: teamspeak-pvc
---
apiVersion: v1
kind: Service
metadata:
  name: teamspeak
  namespace: teamspeak
spec:
  type: NodePort
  selector:
    app: teamspeak
  ports:
    - name: voice
      port: 9987
      targetPort: 9987
      nodePort: 30987
      protocol: UDP
    - name: filetransfer
      port: 30033
      targetPort: 30033
      nodePort: 30033
      protocol: TCP
