From 2b0194c9926145d0d5399cad7f660e6c236ca3c1c04ce15e944d9007f3370ed0 Mon Sep 17 00:00:00 2001 From: Vladislav Date: Tue, 30 Jun 2026 19:13:51 -0400 Subject: [PATCH] =?UTF-8?q?Bot=20commit:=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=20=D1=84=D0=B0=D0=B9=D0=BB=20k8s/stunnel.yam?= =?UTF-8?q?l?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- k8s/stunnel.yaml | 103 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 k8s/stunnel.yaml diff --git a/k8s/stunnel.yaml b/k8s/stunnel.yaml new file mode 100644 index 0000000..1686c20 --- /dev/null +++ b/k8s/stunnel.yaml @@ -0,0 +1,103 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: ssh-reverse-tunnel +spec: + replicas: 1 + selector: + matchLabels: + app: ssh-reverse-tunnel + template: + metadata: + labels: + app: ssh-reverse-tunnel + spec: + imagePullSecrets: + - name: regcred + volumes: + - name: ssh-writable + emptyDir: {} + - name: ssh-key + secret: + secretName: ssh-id-rsa + items: + - key: id_rsa + path: id_rsa + containers: + - name: tunnel + image: registry.spiritofweb.ru/ssh-tunnel:2 + ports: + - name: socks5-tcp + containerPort: 1080 + protocol: TCP + - name: mongo-tcp + containerPort: 27017 + protocol: TCP + env: + - name: REMOTE_USER + valueFrom: + secretKeyRef: + name: ssh-creds + key: username + - name: REMOTE_HOST + valueFrom: + secretKeyRef: + name: ssh-creds + key: remote_host + command: ["/bin/sh", "-c"] + args: + - | + set -eu + + mkdir -p /root/.ssh + printf "Host *\n StrictHostKeyChecking no\n UserKnownHostsFile /dev/null\n" > /root/.ssh/config + chmod 600 /root/.ssh/config + + cp /tmp/ssh-id/id_rsa /root/.ssh/id_rsa + chmod 600 /root/.ssh/id_rsa + + exec autossh -M 0 -N \ + -o "ServerAliveInterval=30" \ + -o "ExitOnForwardFailure=yes" \ + -o "StrictHostKeyChecking=no" \ + -o "UserKnownHostsFile=/dev/null" \ + -i /root/.ssh/id_rsa \ + -R 30080:kultmost-api.kultmost:80 \ + -L :6379:localhost:6379 \ + -L :27017:localhost:27017 \ + -R 30300:10.1.77.0:30300 \ + "${REMOTE_USER}@${REMOTE_HOST}" + volumeMounts: + - name: ssh-writable + mountPath: /root/.ssh + - name: ssh-key + mountPath: /tmp/ssh-id + readOnly: true + resources: + limits: + cpu: "100m" + memory: "128Mi" + restartPolicy: Always +--- +apiVersion: v1 +kind: Service +metadata: + name: kultmost-ssh + namespace: kultmost +spec: + selector: + app: ssh-reverse-tunnel + ports: + - name: mongo-tcp + protocol: TCP + port: 27017 + targetPort: 27017 + - name: redis-tcp + protocol: TCP + port: 6379 + targetPort: 6379 + - name: socks5-tcp + protocol: TCP + port: 1080 + targetPort: 1080 + type: ClusterIP