Files
homelab/k8s/apps/immich/deployments.yaml
2025-05-12 17:04:42 +00:00

328 lines
7.6 KiB
YAML

#---
#apiVersion: apps/v1
#kind: Deployment
#metadata:
# name: immich-server
#spec:
# replicas: 1
# selector:
# matchLabels:
# app: immich-server
# template:
# metadata:
# labels:
# app: immich-server
# spec:
# containers:
# - name: immich-server
# image: ghcr.io/immich-app/immich-server:release
# imagePullPolicy: Always
# ports:
# - containerPort: 2283
# env:
# - name: UPLOAD_LOCATION
# value: /usr/src/app/upload
# - name: DB_PASSWORD
# value: postgres
# - name: DB_USERNAME
# value: postgres
# - name: DB_DATABASE_NAME
# value: immich
# - name: REDIS_HOST
# value: redis
# - name: REDIS_PORT
# value: "6379"
# - name: TZ
# value: Asia/Nicosia
# volumeMounts:
# - mountPath: /usr/src/app/upload
# name: upload-storage
# - mountPath: /GPHOTO
# name: gphoto-storage
# - mountPath: /etc/localtime
# name: localtime
# readOnly: true
# affinity:
# nodeAffinity:
# preferredDuringSchedulingIgnoredDuringExecution:
# - weight: 100
# preference:
# matchExpressions:
# - key: kubernetes.io/hostname
# operator: In
# values:
# - home.homenet
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: kubernetes.io/hostname
# operator: In
# values:
# - home.homenet
# - nas.homenet
# volumes:
# - name: upload-storage
# persistentVolumeClaim:
# claimName: immich-upload-pvc
# - name: gphoto-storage
# persistentVolumeClaim:
# claimName: immich-gphoto-pvc
# - name: localtime
# hostPath:
# path: /etc/localtime
# type: File
#---
#apiVersion: apps/v1
#kind: Deployment
#metadata:
# name: immich-machine-learning
#spec:
# replicas: 2
# selector:
# matchLabels:
# app: immich-ml
# template:
# metadata:
# labels:
# app: immich-ml
# spec:
# affinity:
# nodeAffinity:
# preferredDuringSchedulingIgnoredDuringExecution:
# - weight: 100
# preference:
# matchExpressions:
# - key: kubernetes.io/hostname
# operator: In
# values:
# - home.homenet
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: kubernetes.io/hostname
# operator: In
# values:
# - home.homenet
# - nas.homenet
# topologySpreadConstraints:
# - maxSkew: 1
# topologyKey: kubernetes.io/hostname
# whenUnsatisfiable: DoNotSchedule
# labelSelector:
# matchLabels:
# app: immich-ml
# containers:
# - name: immich-ml
# image: ghcr.io/immich-app/immich-machine-learning:release
# imagePullPolicy: Always
# env:
# - name: TZ
# value: Asia/Nicosia
# volumeMounts:
# - mountPath: /cache
# name: model-cache
# volumes:
# - name: model-cache
# emptyDir: {}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: immich-server
spec:
replicas: 1
selector:
matchLabels:
app: immich-server
template:
metadata:
labels:
app: immich-server
spec:
containers:
- name: immich-server
image: ghcr.io/immich-app/immich-server:release
imagePullPolicy: Always
ports:
- containerPort: 2283
env:
- name: UPLOAD_LOCATION
value: /usr/src/app/upload
- name: DB_PASSWORD
value: postgres
- name: DB_USERNAME
value: postgres
- name: DB_DATABASE_NAME
value: immich
- name: REDIS_HOST
value: redis
- name: REDIS_PORT
value: "6379"
- name: TZ
value: Asia/Nicosia
volumeMounts:
- mountPath: /usr/src/app/upload
name: upload-storage
- mountPath: /GPHOTO
name: gphoto-storage
- mountPath: /etc/localtime
name: localtime
readOnly: true
nodeSelector:
kubernetes.io/hostname: nas.homenet
volumes:
- name: upload-storage
persistentVolumeClaim:
claimName: immich-upload-pvc
- name: gphoto-storage
persistentVolumeClaim:
claimName: immich-gphoto-pvc
- name: localtime
hostPath:
path: /etc/localtime
type: File
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: immich-machine-learning
spec:
replicas: 5
selector:
matchLabels:
app: immich-ml
template:
metadata:
labels:
app: immich-ml
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- home.homenet
#- nas.homenet
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 30
preference:
matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- nas.homenet
- weight: 70
preference:
matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- home.homenet
topologySpreadConstraints:
- maxSkew: 2
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: immich-ml
containers:
- name: immich-ml
image: ghcr.io/immich-app/immich-machine-learning:release
imagePullPolicy: Always
env:
- name: TZ
value: Asia/Nicosia
volumeMounts:
- mountPath: /cache
name: model-cache
volumes:
- name: model-cache
emptyDir: {}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis
spec:
replicas: 1
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
image: redis:6.2-alpine
readinessProbe:
exec:
command: ["redis-cli", "ping"]
nodeSelector:
kubernetes.io/hostname: nas.homenet
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: database
spec:
replicas: 1
selector:
matchLabels:
app: database
template:
metadata:
labels:
app: database
spec:
securityContext:
fsGroup: 999
containers:
- name: immich-postgres
image: tensorchord/pgvecto-rs:pg14-v0.2.0
securityContext:
runAsUser: 999
runAsGroup: 999
env:
- name: POSTGRES_PASSWORD
value: postgres
- name: POSTGRES_USER
value: postgres
- name: POSTGRES_DB
value: immich
- name: POSTGRES_INITDB_ARGS
value: '--data-checksums'
- name: TZ
value: Asia/Nicosia
command: ["postgres"]
args:
- "-c"
- "shared_preload_libraries=vectors.so"
- "-c"
- "search_path='\"$user\", public, vectors'"
- "-c"
- "log_destination=stderr"
- "-c"
- "max_wal_size=2GB"
- "-c"
- "shared_buffers=512MB"
- "-c"
- "wal_compression=on"
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: db-storage
nodeSelector:
kubernetes.io/hostname: nas.homenet
volumes:
- name: db-storage
persistentVolumeClaim:
claimName: immich-db-pvc