feat(deploy): split node1 and node4 manifests and cap box2 home at 150Gi
Node4 drops the egress proxy. Its home volume is a 150Gi LVM logical volume so the filesystem size is a real quota.
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
# Namespace, DCR pull secret, SSH allowlist, Service.
|
||||
# Reconciled by Flux Kustomization cursor-devbox (path ./deploy/node4-k3s) on node4-k3s.
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: cursor-devbox
|
||||
labels:
|
||||
name: cursor-devbox
|
||||
annotations:
|
||||
linkerd.io/inject: disabled
|
||||
|
||||
---
|
||||
# Replicate federated DCR RO credentials for kubelet imagePullSecrets.
|
||||
apiVersion: secret-adapter.trinitysan.by/v1
|
||||
kind: SecretAdapter
|
||||
metadata:
|
||||
name: dcr-registry-auth-ro
|
||||
namespace: cursor-devbox
|
||||
spec:
|
||||
name: dcr-registry-auth-ro
|
||||
namespace: cursor-devbox
|
||||
type: kubernetes.io/dockerconfigjson
|
||||
waitForSources: true
|
||||
syncInterval: 60
|
||||
stringData:
|
||||
.dockerconfigjson: ${federated-secrets.dcr-registry-auth-ro.".dockerconfigjson"}
|
||||
|
||||
---
|
||||
# Hardcoded allowlist: laptop SSH public keys (not secrets).
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: cursor-devbox-authorized-keys
|
||||
namespace: cursor-devbox
|
||||
data:
|
||||
authorized_keys: |
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDbyPCd5RhlTZYCIgmrSGR6ugnwI513vzHf0qvUP3pGf8mYVd68G6CLu9OXJxFv+LKo2eT8H3ToxLpuG0iiIWz+4rJrNXTJInU2lqrcMsHhLoo1XCs7OAARYiIp7Pl4XKcLdbiXwdL2XUsHImv7cjmaD6jGJ3yR+q9t6jORQEB/h6nUc0MMkNKLIrUyJSlZtWRp22ymGnEqiwKl9doukii6QBhY1k+i9oW09ln6gbFTol9KoONkJ74b2iKw5abZwyjjXuXaE1b98/nmI30MYs8VMJC/w9pEZbmVEflb1k4+C1IE5llwmievjNWpWlZt38uzvGTLbiC9mMIewwFm4UsT5ASLpYKBdFrCaK4JIOTCdJt+SMInkzz0rArCNPMBwZIjBgCFSM33nJsX4gbf/l/rnVtLjXr86rF5s9SOSVyQmjPJoBigqyGw45H2CrB7iTqqWGCpPTnXbzzspiIQGYXLW5+5/4wARCPO0KXYcPgg4Vzh5z+dMcFKJvc8XhocZCc= aaa@LAPTOP-08PG1IL5
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDK+dk9MtPgRZr7638SASpbJK7z+XkmBesXRlozTFqvT0X6gKk+75kyqNR2W+ZXDwiiWuXS2t9Dbdk9Xpuj2uWaUE0D+n3NOFEQV27Zd1ZTMeLlf3ukSLhb7un0pFHXQXvPn2Iwhh5zCyTDvIWU1rHUgBmakmxoRZ6zwJdsZX/yZHurts//7Dvb2xKKYAq4MFMAB+s6Ch80q6kCnHcByJVFyVLfOUVcNzHGUQbbj4pft2QYiTVxqTBZdvdWQvdBRkKjV2oK/mRUfGsdwmk+ldT65hdcFjbG3oG4hD3g2+AJC+/vN/xqlCeht/TU/Ei4GMF3UB3ank7z1rsGbU1T5lDoFWBWMg+tgw7ZdbYD+HIi/kuQU3FKM2xekB2fgpzuu5GQynjflygBmuQQp5/HAJDoxrkt+Yn79QX6aan8xXcHnt600Bm7SWfnsCl6BpcaD/8f2Lr8CcFCN5pcG020gvLSVdok71dB27NQ/2HOax1i0WQTZVjDrL6kMwRb37njr/k= svv@LAPTOP-08PG1IL5
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID6eoy26uB34KMWMB0tbsqNHNoiF6X9gOta12vCiqZpJ djest@DESKTOP-A4K82V0
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: cursor-devbox
|
||||
namespace: cursor-devbox
|
||||
annotations:
|
||||
service.kubernetes.io/topology-mode: Auto
|
||||
spec:
|
||||
selector:
|
||||
app: cursor-devbox
|
||||
ports:
|
||||
- name: ssh
|
||||
port: 22
|
||||
targetPort: ssh
|
||||
protocol: TCP
|
||||
- name: http
|
||||
port: 8080
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
@@ -0,0 +1,110 @@
|
||||
# File-backed LVM so the home filesystem cannot grow past 150Gi.
|
||||
# The node root disk is one ext4; a 152Gi image is the volume group, the LV is 150Gi.
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: cursor-devbox-lvm
|
||||
namespace: cursor-devbox
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: cursor-devbox-lvm
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: cursor-devbox-lvm
|
||||
spec:
|
||||
hostPID: true
|
||||
tolerations:
|
||||
- operator: Exists
|
||||
containers:
|
||||
- name: setup
|
||||
image: ubuntu:24.04
|
||||
imagePullPolicy: IfNotPresent
|
||||
securityContext:
|
||||
privileged: true
|
||||
command: ["nsenter", "-t", "1", "-m", "-u", "-i", "--", "bash", "-c"]
|
||||
args:
|
||||
- |
|
||||
set -euo pipefail
|
||||
mkdir -p /var/lib/cursor-devbox /usr/local/sbin /mnt/cursor-devbox-home
|
||||
cat > /usr/local/sbin/cursor-devbox-lvm-setup << 'EOF'
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
IMG=/var/lib/cursor-devbox/backing.img
|
||||
MNT=/mnt/cursor-devbox-home
|
||||
mkdir -p /var/lib/cursor-devbox "$MNT"
|
||||
if [ ! -f "$IMG" ]; then
|
||||
fallocate -l 152G "$IMG"
|
||||
fi
|
||||
if ! losetup -j "$IMG" | grep -q .; then
|
||||
losetup -f "$IMG"
|
||||
fi
|
||||
LOOP=$(losetup -j "$IMG" | awk -F: 'NR==1 {print $1}')
|
||||
if ! vgs cursor-devbox >/dev/null 2>&1; then
|
||||
pvcreate "$LOOP"
|
||||
vgcreate cursor-devbox "$LOOP"
|
||||
fi
|
||||
vgchange -ay cursor-devbox
|
||||
if ! lvs cursor-devbox/home >/dev/null 2>&1; then
|
||||
lvcreate -L 150G -n home cursor-devbox
|
||||
mkfs.ext4 -F /dev/cursor-devbox/home
|
||||
fi
|
||||
if ! mountpoint -q "$MNT"; then
|
||||
mount /dev/cursor-devbox/home "$MNT"
|
||||
fi
|
||||
EOF
|
||||
chmod 755 /usr/local/sbin/cursor-devbox-lvm-setup
|
||||
cat > /etc/systemd/system/cursor-devbox-lvm.service << 'EOF'
|
||||
[Unit]
|
||||
Description=Cursor devbox home LVM
|
||||
DefaultDependencies=no
|
||||
After=local-fs.target
|
||||
Before=k3s.service
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/usr/local/sbin/cursor-devbox-lvm-setup
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl daemon-reload
|
||||
systemctl enable cursor-devbox-lvm.service
|
||||
/usr/local/sbin/cursor-devbox-lvm-setup
|
||||
sleep infinity
|
||||
resources:
|
||||
requests:
|
||||
cpu: 20m
|
||||
memory: 32Mi
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 256Mi
|
||||
---
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: cursor-devbox-lvm
|
||||
provisioner: kubernetes.io/no-provisioner
|
||||
volumeBindingMode: WaitForFirstConsumer
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: cursor-devbox-home
|
||||
spec:
|
||||
capacity:
|
||||
storage: 150Gi
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
storageClassName: cursor-devbox-lvm
|
||||
local:
|
||||
path: /mnt/cursor-devbox-home
|
||||
nodeAffinity:
|
||||
required:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: kubernetes.io/hostname
|
||||
operator: In
|
||||
values:
|
||||
- ssdnodes-6aa563e76974d
|
||||
@@ -0,0 +1,113 @@
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: cursor-devbox
|
||||
namespace: cursor-devbox
|
||||
spec:
|
||||
serviceName: cursor-devbox
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: cursor-devbox
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: cursor-devbox
|
||||
annotations:
|
||||
linkerd.io/inject: disabled
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 30
|
||||
imagePullSecrets:
|
||||
- name: dcr-registry-auth-ro
|
||||
containers:
|
||||
- name: ssh
|
||||
image: dcr.trinitysan.by/infra/cursor-devbox:10-90c6b6c4250a68f4cb654bc18e52f2a47f9dc3a4 # {"$imagepolicy": "flux-system:cursor-devbox"}
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: ssh
|
||||
containerPort: 22
|
||||
- name: http
|
||||
containerPort: 8080
|
||||
env:
|
||||
- name: DOCKER_HOST
|
||||
value: tcp://127.0.0.1:2375
|
||||
- name: HOME
|
||||
value: /home/developer
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: true
|
||||
capabilities:
|
||||
add:
|
||||
- SYS_PTRACE
|
||||
resources:
|
||||
requests:
|
||||
cpu: "750m"
|
||||
memory: 3Gi
|
||||
limits:
|
||||
cpu: "4"
|
||||
memory: 8Gi
|
||||
# startupProbe covers slow first boot (sshd after host-key/auth setup).
|
||||
startupProbe:
|
||||
tcpSocket:
|
||||
port: ssh
|
||||
failureThreshold: 60
|
||||
periodSeconds: 10
|
||||
readinessProbe:
|
||||
tcpSocket:
|
||||
port: ssh
|
||||
periodSeconds: 10
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
port: ssh
|
||||
periodSeconds: 20
|
||||
volumeMounts:
|
||||
- name: home
|
||||
mountPath: /home/developer
|
||||
subPath: home
|
||||
- name: authorized-keys
|
||||
mountPath: /etc/ssh-authorized-keys
|
||||
readOnly: true
|
||||
- name: dind
|
||||
image: docker:27-dind
|
||||
imagePullPolicy: IfNotPresent
|
||||
args:
|
||||
- --host=tcp://0.0.0.0:2375
|
||||
- --tls=false
|
||||
env:
|
||||
- name: DOCKER_TLS_CERTDIR
|
||||
value: ""
|
||||
securityContext:
|
||||
privileged: true
|
||||
resources:
|
||||
requests:
|
||||
cpu: "250m"
|
||||
memory: 1Gi
|
||||
limits:
|
||||
cpu: "2"
|
||||
memory: 4Gi
|
||||
readinessProbe:
|
||||
tcpSocket:
|
||||
port: 2375
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
volumeMounts:
|
||||
- name: home
|
||||
mountPath: /var/lib/docker
|
||||
subPath: docker
|
||||
- name: dind-run
|
||||
mountPath: /var/run
|
||||
volumes:
|
||||
- name: authorized-keys
|
||||
configMap:
|
||||
name: cursor-devbox-authorized-keys
|
||||
- name: dind-run
|
||||
emptyDir: {}
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: home
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: cursor-devbox-lvm
|
||||
resources:
|
||||
requests:
|
||||
storage: 150Gi
|
||||
@@ -0,0 +1,35 @@
|
||||
# Traefik TCP SSH + TrinityIngress HTTP health on node4 (box2.trinitysan.by).
|
||||
|
||||
---
|
||||
# Traefik TCP :2222 → OpenSSH in the pod (plain SSH; HostSNI catch-all).
|
||||
apiVersion: traefik.io/v1alpha1
|
||||
kind: IngressRouteTCP
|
||||
metadata:
|
||||
name: cursor-devbox-ssh
|
||||
namespace: cursor-devbox
|
||||
spec:
|
||||
entryPoints:
|
||||
- ssh
|
||||
routes:
|
||||
- match: HostSNI(`*`)
|
||||
services:
|
||||
- name: cursor-devbox
|
||||
port: 22
|
||||
|
||||
---
|
||||
# DNS A record + HTTPS front for the tiny HTTP health page; SSH uses Traefik TCP :2222.
|
||||
apiVersion: ingress.trinitysan.by/v1
|
||||
kind: TrinityIngress
|
||||
metadata:
|
||||
name: cursor-devbox
|
||||
namespace: cursor-devbox
|
||||
annotations:
|
||||
# cert-manager HTTP-01 self-check must reach Traefik :80, not the SSH Service.
|
||||
ingress.trinitysan.by/internal-route-to-traefik: "true"
|
||||
spec:
|
||||
hostname: box2.trinitysan.by
|
||||
serviceRef:
|
||||
namespace: cursor-devbox
|
||||
name: cursor-devbox
|
||||
port: 8080
|
||||
certificateReclaimPolicy: Retain
|
||||
@@ -0,0 +1,7 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- 010-namespace-secrets.yaml
|
||||
- 015-lvm.yaml
|
||||
- 020-statefulset.yaml
|
||||
- 030-ingress.yaml
|
||||
Reference in New Issue
Block a user