mirror of
https://github.com/Alkatrazz24/Funk-lab.git
synced 2026-07-08 17:44:42 +02:00
Le pod SearXNG crashait en boucle : granian recevait --port tcp://<ip>:8080 au lieu d'un entier. Cause classique k8s : le Service « searxng » fait injecter l'env service-link SEARXNG_PORT=tcp://<clusterIP>:8080, que l'entrypoint SearXNG lit comme port de bind. - enableServiceLinks:false (coupe l'injection des env service-link, inutiles ici) - SEARXNG_PORT=8080 + SEARXNG_BIND_ADDRESS=0.0.0.0 explicites (défense en profondeur) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
93 lines
3.3 KiB
YAML
93 lines
3.3 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: searxng
|
|
namespace: ai
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: searxng
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: searxng
|
|
annotations:
|
|
# Redéploie le pod quand settings.yml change (le hash bouge → nouveau rollout).
|
|
checksum/config: "searxng-settings-v1"
|
|
spec:
|
|
# CRITIQUE : le Service s'appelle « searxng » → sans ça, k8s injecte la variable
|
|
# SEARXNG_PORT=tcp://<clusterIP>:8080 (env « service link » façon Docker), que l'entrypoint
|
|
# SearXNG lit comme PORT de bind → granian crash (« 'tcp://…:8080' is not a valid integer »).
|
|
# On coupe l'injection des service-links (inutiles ici) ; on fixe aussi le port en dur ci-dessous.
|
|
enableServiceLinks: false
|
|
# Conformité PodSecurity "restricted" (namespace ai). L'image tourne en uid 977 (searxng).
|
|
# fsGroup 977 → l'emptyDir /etc/searxng est accessible en écriture par l'init + le main.
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
runAsUser: 977
|
|
runAsGroup: 977
|
|
fsGroup: 977
|
|
seccompProfile:
|
|
type: RuntimeDefault
|
|
# Copie settings.yml (ConfigMap RO) dans un emptyDir inscriptible → évite les soucis
|
|
# de mount RO de l'entrypoint searxng (chown/sed éventuels sur le fichier de conf).
|
|
initContainers:
|
|
- name: copy-config
|
|
image: docker.io/searxng/searxng:2026.6.22-952896d29
|
|
command: ["sh", "-c", "cp /config-src/settings.yml /etc/searxng/settings.yml"]
|
|
securityContext:
|
|
allowPrivilegeEscalation: false
|
|
capabilities:
|
|
drop: ["ALL"]
|
|
volumeMounts:
|
|
- name: config-src
|
|
mountPath: /config-src
|
|
readOnly: true
|
|
- name: config
|
|
mountPath: /etc/searxng
|
|
containers:
|
|
- name: searxng
|
|
image: docker.io/searxng/searxng:2026.6.22-952896d29
|
|
securityContext:
|
|
allowPrivilegeEscalation: false
|
|
capabilities:
|
|
drop: ["ALL"]
|
|
ports:
|
|
- containerPort: 8080
|
|
env:
|
|
# Port/bind explicites (défense en profondeur vs l'env service-link, déjà coupé
|
|
# par enableServiceLinks:false) — l'entrypoint SearXNG lit ces variables.
|
|
- name: SEARXNG_PORT
|
|
value: "8080"
|
|
- name: SEARXNG_BIND_ADDRESS
|
|
value: "0.0.0.0"
|
|
# Base URL interne (pas d'exposition WAN). Requis par SearXNG pour générer ses liens.
|
|
- name: SEARXNG_BASE_URL
|
|
value: "http://searxng.lab.local/"
|
|
volumeMounts:
|
|
- name: config
|
|
mountPath: /etc/searxng
|
|
readinessProbe:
|
|
tcpSocket:
|
|
port: 8080
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 10
|
|
livenessProbe:
|
|
tcpSocket:
|
|
port: 8080
|
|
initialDelaySeconds: 15
|
|
periodSeconds: 20
|
|
resources:
|
|
requests:
|
|
cpu: 100m
|
|
memory: 192Mi
|
|
limits:
|
|
cpu: "1"
|
|
memory: 512Mi
|
|
volumes:
|
|
- name: config-src
|
|
configMap:
|
|
name: searxng-settings
|
|
- name: config
|
|
emptyDir: {}
|