rustdesk / rustdesk-server

RustDesk Server Program
https://rustdesk.com/server
GNU Affero General Public License v3.0
6.75k stars 1.46k forks source link

Docs: Kubernetes Deployment #85

Closed secana closed 2 years ago

secana commented 2 years ago

Hi, I've installed rustdesk on Kubernetes based on the Docker Compose example.

Maybe you are interested in adding the deployment as an example on the docs page.

rustdesk.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: rustdesk
spec:
  replicas: 1
  selector:
    matchLabels:
      app: rustdesk
  template:
    metadata:
      labels:
        app: rustdesk
    spec:
      containers:
        - args:
            - hbbr
          image: rustdesk/rustdesk-server:latest-arm64v8
          name: hbbr
          ports:
            - containerPort: 21117
            - containerPort: 21119
          resources:
            limits:
              memory: "128Mi"
              cpu: "200m"
            requests:
              memory: "64Mi"
              cpu: "100m"
          volumeMounts:
            - mountPath: /root
              name: hbbr-claim0
        - args:
            - hbbs
            - -r
            - localhost:21117
          image: rustdesk/rustdesk-server:latest-arm64v8
          name: hbbs
          ports:
            - containerPort: 21115
            - containerPort: 21116
            - containerPort: 21116
              protocol: UDP
            - containerPort: 21118
          resources: 
            limits:
              memory: "128Mi"
              cpu: "200m"
            requests:
              memory: "64Mi"
              cpu: "100m"
          volumeMounts:
            - mountPath: /root
              name: hbbs-claim0
      volumes:
        - name: hbbr-claim0
          persistentVolumeClaim:
            claimName: hbbr-claim0
        - name: hbbs-claim0
          persistentVolumeClaim:
            claimName: hbbs-claim0
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: hbbr-claim0
spec:
  storageClassName: default
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Mi
status: {}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: hbbs-claim0
spec:
  storageClassName: default
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Mi
status: {}
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: rustdesk
  name: rustdesk-tcp
spec:
  ports:
    - name: "21117"
      port: 21117
      targetPort: 21117
    - name: "21119"
      port: 21119
      targetPort: 21119
    - name: "21115"
      port: 21115
      targetPort: 21115
    - name: "21116"
      port: 21116
      targetPort: 21116
    - name: "21118"
      port: 21118
      targetPort: 21118
  externalTrafficPolicy: Local
  selector:
    app: rustdesk
  type: LoadBalancer
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: rustdesk
  name: rustdesk-udp
spec:
  ports:
    - name: 21116-udp
      port: 21116
      protocol: UDP
      targetPort: 21116
  externalTrafficPolicy: Local
  selector:
    app: rustdesk
  type: LoadBalancer

Deploy the whole application with kubectl apply -f rustdesk.yaml

I had no time to create a helm chart to automate the deployment above, but maybe I'm doing that later.

paspo commented 2 years ago

I think it's a bit early for kubernetes support. If we insert this into the docs repo, we should start to support kubernetes installations, but the containers IMHO are not ready yet.

Specifically, we need:

secana commented 2 years ago

Thanks for the response. I understand why rustdesk isn't ready to support kubernetes officially. It is fine be me, if this issue gets closed. If someone searches for a solution to run it on k8s until official support is there, finding this issue with google is a good option.

paspo commented 2 years ago

I totally agree

aliuq commented 1 year ago

NodePort not works?

Hobbit44 commented 4 months ago

For a helm configuration, you can use app-template which builds on the common library from bjw-s. This is my code (using pulumi).

rustdesk.ts

```typescript import { Namespace } from "@pulumi/kubernetes/core/v1"; import { Release } from "@pulumi/kubernetes/helm/v3"; export const rustdesk = (namespace: Namespace, localDomain: string ) => { new Release("rustdesk", { name: "rustdesk", repositoryOpts: { repo: "https://bjw-s.github.io/helm-charts", }, chart: "app-template", namespace: namespace.metadata.name, values: { controllers: { rustdesk: { containers: { hbbr: { image: { repository: "rustdesk/rustdesk-server", tag: "latest", }, args: [ "hbbr", ], ports: [ { containerPort: 21117 }, { containerPort: 21119 }, ], }, hbbs: { image: { repository: "rustdesk/rustdesk-server", tag: "latest", }, args: [ "hbbs", "-r", "localhost:21117", ], ports: [ { containerPort: 21115 }, { containerPort: 21116 }, { containerPort: 21116, protocol: "UDP" }, { containerPort: 21118 }, ], }, }, }, }, persistence: { hbbr: { type: "persistentVolumeClaim", accessMode: "ReadWriteOnce", size: "1Gi", advancedMounts: { rustdesk: { hbbr: [{ path: "/root", }], }, }, }, hbbs: { type: "persistentVolumeClaim", accessMode: "ReadWriteOnce", size: "1Gi", advancedMounts: { rustdesk: { hbbs: [{ path: "/root", }], }, }, }, }, service: { main: { controller: "rustdesk", type: "LoadBalancer", annotations: { "external-dns.alpha.kubernetes.io/hostname": `rustdesk.${localDomain}`, "metallb.universe.tf/address-pool": "default", "metallb.universe.tf/allow-shared-ip": "10.0.1.30", }, ports: { nat: { port: 21115, protocol: "TCP", }, register: { port: 21116, protocol: "UDP", }, hole: { port: 21116, protocol: "TCP", }, relay: { port: 21117, protocol: "TCP", }, hbbsweb: { enabled: false, port: 21118, }, hbbrweb: { enabled: false, port: 21119, }, }, }, }, }, }, { parent: namespace }); } ```