K3s and TeamSpeak

Hello,

After switching from my docker setup to a single node k3s cluster, I could not easily get TeamSpeak to run. The main problem being on how to expose the ports. My first idea was to use NodePort, but that did not work, since I would need to have changed the port range to include the lower ports TeamSpeak uses (i.e. 9987). But changing the cluster config for a single application was not a suitable solution. Then I tried to route it through the included Traefik install, but there the entry points were not created properly for some reason. The next option was to install a proper Loadbalancer such as MetalLB, but this seems a bit overkill for a single node cluster. Finally, I decided on using the external IP feature of Kubernetes, which resulted in a service like this: 


apiVersion: v1
kind: Service
metadata:
  name: ts-svc
  labels: [...]
spec:
  type: ClusterIP
  ports:
    - name: udp-port
      protocol: UDP
      port: 9987
      targetPort: 9987
    - name: tcp-port1
      protocol: TCP
      port: 30033
      targetPort: 30033
    - name: tcp-port2
      protocol: TCP
      port: 10011
      targetPort: 10011
  externalIPs:
    - 1.2.3.4
  selector: [...]

This made it possible to expose the ports on the IP defined, and the TeamSpeak is finally reachable.

Sources:
https://kubernetes.io/docs/concepts/services-networking/service/#external-ips