Files
phpfpm/templates/deployment-selenium.yaml
T
claude 86cd705d06
Helm Chart Release / release-chart (push) Successful in 6s
fix: Seleniumを独立Deployment/Serviceに分離しresourcesの死んだ設定を修正
selenium.enabled=true構成でphp-fpmのCrashLoopBackOffとサイト完全停止が続いた件を調査し、2つの設計上の欠陥を確認した。(1) resources values キーがテンプレートで一切参照されておらず、全コンテナがQoS Class: BestEffortで動作しOOM Killされやすい状態だった。(2) nginx/php-fpm/SeleniumをすべてSelenium同一Podで起動しており、Kubernetesの Pod Ready判定(全コンテナのAND)により、Seleniumだけが不調でもPod全体がServiceのEndpointsから外れ、Seleniumを使わない静的ページ配信まで巻き込まれてサービス全体が停止していた。対応: Seleniumを独立Deployment(<release>-phpfpm-selenium)/Serviceに分離し、SELENIUM_URLを自動注入。resourcesをnginx/phpfpm/selenium個別に構造化して実際にコンテナへ反映されるよう修正。詳細はCHANGELOG-8.5.10-b.md参照。
2026-09-26 08:05:10 +09:00

69 lines
2.9 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{{- if .Values.selenium.enabled }}
# Selenium を nginx/php-fpm と別 Deployment にする理由(v8.5.10-b):
#
# 以前は selenium/standalone-chromium を nginx・php-fpm と同一 Pod のサイドカー
# コンテナとして起動していた。Kubernetes は Pod の Ready 条件を「全コンテナが Ready」
# の AND で判定するため、readinessProbe を持たないコンテナは「Running であれば Ready」
# として扱われる一方、CrashLoopBackOff で Waiting/Terminated を繰り返す間は Ready=false
# になる。この間 Pod 全体が Service の Endpoints から外れるため、Selenium コンテナ
# だけが不安定(起動失敗・OOM等)でも、Selenium を全く使わない静的ページの配信まで
# 巻き込まれてサービス全体が完全停止していた。
#
# Selenium を独立した Deployment/Service に分離することで、Selenium の不調が
# nginx/php-fpm Pod の Ready 状態に一切影響しなくなり、スクレイピング機能のみが
# 影響を受け、サイト自体は表示され続ける。
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "phpfpm.fullname" . }}-selenium
labels:
{{- include "phpfpm.labels" . | nindent 4 }}
app.kubernetes.io/component: selenium
spec:
replicas: {{ .Values.selenium.replicaCount | default 1 }}
selector:
matchLabels:
{{- include "phpfpm.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: selenium
template:
metadata:
labels:
{{- include "phpfpm.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: selenium
spec:
containers:
- name: selenium
image: "{{ .Values.image.selenium.registry }}/{{ .Values.image.selenium.repository }}:{{ .Values.image.selenium.tag }}"
imagePullPolicy: {{ .Values.image.selenium.pullPolicy }}
ports:
- containerPort: 4444 # Selenium用ポート
{{- with .Values.selenium.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.selenium.mountHtml }}
volumeMounts:
- name: app-storage
mountPath: /var/www/html
subPath: html
{{- end }}
dnsPolicy: ClusterFirst
dnsConfig:
options:
- name: ndots
value: "1"
{{- if .Values.selenium.mountHtml }}
volumes:
- name: app-storage
# 別 Pod から同じ PVC の html/ サブパスを読み書きするため、
# persistence.accessMode を ReadWriteMany にする必要がある
# (NFS バックエンドの StorageClass なら対応可能)。
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ include "phpfpm.fullname" . }}-pvc
{{- else }}
emptyDir: {}
{{- end }}
{{- end }}
{{- end }}