atlas-iac/services/hermes/local-image-deployment.yaml

130 lines
4.4 KiB
YAML

# services/hermes/local-image-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: hermes-local-image
namespace: hermes
labels:
app: hermes-local-image
spec:
replicas: 1
revisionHistoryLimit: 2
strategy:
type: Recreate
selector:
matchLabels:
app: hermes-local-image
template:
metadata:
labels:
app: hermes-local-image
annotations:
ai.bstein.dev/model: black-forest-labs/FLUX.2-klein-4B
ai.bstein.dev/gpu: titan-24 lease-shared image, desktop, and Wolf lane
ai.bstein.dev/config-rev: "20260811-flux2-klein-low-vram"
spec:
serviceAccountName: hermes-gpu-runtime
runtimeClassName: nvidia
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- titan-24
volumes:
- name: models
persistentVolumeClaim:
claimName: hermes-image-models
- name: local-image-tmp
emptyDir:
sizeLimit: 2Gi
containers:
- name: local-image
image: registry.bstein.dev/bstein/hermes-local-image@sha256:d6257f49a60244fb1e30733848a187fa932acebfdb82a2560d4e760fa018b645
imagePullPolicy: IfNotPresent
ports:
- name: local-image
containerPort: 9004
env:
- name: HERMES_LOCAL_IMAGE_MODEL
value: black-forest-labs/FLUX.2-klein-4B
- name: HERMES_LOCAL_IMAGE_REVISION
value: e7b7dc27f91deacad38e78976d1f2b499d76a294
- name: HERMES_LOCAL_IMAGE_LISTEN_PORT
value: "9004"
- name: LEASE_NAMESPACE
value: hermes
- name: LEASE_NAME
value: titan-24-gpu-owner
- name: LEASE_IDLE_OWNER
value: hermes
- name: LEASE_IMAGE_OWNER
value: hermes-image
- name: HERMES_LOCAL_IMAGE_GPU_ACTIVITY_URL
value: http://nvidia-process-exporter-local.monitoring.svc.cluster.local:9401/metrics
- name: HERMES_LOCAL_IMAGE_GPU_ACTIVITY_NODE
value: titan-24
# The lease is authoritative for checkout state. Keep a high SM
# ceiling only as a fail-safe for unregistered GPU workloads;
# desktop compositors can briefly spike well above their idle use.
- name: HERMES_LOCAL_IMAGE_GPU_ACTIVE_SM_PERCENT
value: "80"
- name: HERMES_LOCAL_IMAGE_GPU_MAX_EXTERNAL_MEMORY_BYTES
value: "3221225472"
- name: HERMES_LOCAL_IMAGE_GPU_ACTIVITY_SAMPLES
value: "3"
- name: HERMES_LOCAL_IMAGE_GPU_ACTIVITY_SAMPLE_INTERVAL
value: "1"
- name: HERMES_LOCAL_IMAGE_RENDER_TIMEOUT
value: "1200"
- name: HERMES_LOCAL_IMAGE_OFFLOAD_MODE
value: sequential
- name: PYTORCH_CUDA_ALLOC_CONF
value: expandable_segments:True
- name: HF_HOME
value: /models/huggingface
- name: HOME
value: /tmp
- name: NVIDIA_VISIBLE_DEVICES
value: all
- name: NVIDIA_DRIVER_CAPABILITIES
value: compute,utility
volumeMounts:
- name: models
mountPath: /models
- name: local-image-tmp
mountPath: /tmp
readinessProbe:
httpGet:
path: /health
port: local-image
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 5
livenessProbe:
httpGet:
path: /health
port: local-image
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 5
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: [ALL]
readOnlyRootFilesystem: true
seccompProfile:
type: RuntimeDefault
resources:
requests:
cpu: "4"
memory: 12Gi
nvidia.com/gpu.shared: 1
limits:
cpu: "12"
memory: 28Gi
nvidia.com/gpu.shared: 1