This commit is contained in:
TonyChyi
2022-08-15 08:29:50 +08:00
parent 81cf4d31d1
commit 2ee24134e6
13 changed files with 978 additions and 10 deletions

11
code-ssh/Dockerfile Normal file
View File

@@ -0,0 +1,11 @@
FROM debian:stable-slim
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list && \
apt-get update && \
apt-get install -y zsh dropbear-bin python3 python3-pip python3-virtualenv vim sudo curl git && \
mkdir -p /etc/dropbear && \
useradd -s /bin/zsh -u 1000 coder && \
echo 'coder ALL=(ALL:ALL) NOPASSWD:ALL' >> /etc/sudoers && \
apt-get clean
CMD [ "/usr/sbin/dropbear", "-swEF" ]

4
code-ssh/build.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
docker build -t tonychee7000/code-ssh:$1 .
docker push tonychee7000/code-ssh:$1

Binary file not shown.

View File

@@ -0,0 +1,2 @@
AAAAC3NzaC1lZDI1NTE5AAAAQKtWqf+I28KI3ZLGK78bEjhcMkt1s4OtwxtDClF8oyT4Yjtobr3p
Nm0gkElJn/MqjMpsb08iboaFbz2KqsA9mE8=

54
code-ssh/deployment.yaml Normal file
View File

@@ -0,0 +1,54 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: code-ssh
spec:
selector:
matchLabels:
app: code-ssh
template:
metadata:
labels:
app: code-ssh
spec:
volumes:
- name: data
hostPath:
path: /data/code-server
- name: config
secret:
secretName: code-ssh-host-key
optional: false
containers:
- name: code-ssh
image: linuxserver/openssh-server:latest
volumeMounts:
- mountPath: /home/coder
name: data
- mountPath: /etc/dropbear
name: config
readOnly: true
resources:
limits:
cpu: 500m
memory: 4Gi
requests:
cpu: 100m
memory: 256Mi
readinessProbe:
tcpSocket:
port: ssh
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
livenessProbe:
tcpSocket:
port: ssh
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
ports:
- containerPort: 22
name: ssh

View File

@@ -0,0 +1,17 @@
# yaml-language-server: $schema=https://json.schemastore.org/kustomization.json
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- service.yaml
commonLabels:
app: code-ssh
images:
- name: linuxserver/openssh-server
newName: tonychee7000/code-ssh
newTag: '20220814-1'
secretGenerator:
- name: code-ssh-host-key
files:
- config/dropbear_ed25519_host_key

19
code-ssh/service.yaml Normal file
View File

@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: code-ssh
annotations:
holepunch/punch-external: 'false'
spec:
selector:
app: code-ssh
ports:
- port: 2333
targetPort: ssh
name: ssh
protocol: TCP
type: LoadBalancer
ipFamilyPolicy: PreferDualStack
ipFamilies:
- IPv4
- IPv6