fix: Seleniumを独立Deployment/Serviceに分離しresourcesの死んだ設定を修正
Helm Chart Release / release-chart (push) Successful in 6s

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参照。
This commit is contained in:
2026-09-26 08:05:10 +09:00
parent 6eb1c24732
commit 86cd705d06
9 changed files with 307 additions and 37 deletions
+18 -11
View File
@@ -9,10 +9,12 @@ spec:
selector:
matchLabels:
{{- include "phpfpm.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: web
template:
metadata:
labels:
{{- include "phpfpm.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: web
spec:
containers:
- name: nginx
@@ -20,6 +22,10 @@ spec:
imagePullPolicy: {{ .Values.image.nginx.pullPolicy }}
ports:
- containerPort: 80
{{- with .Values.resources.nginx }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- name: app-storage
mountPath: /var/www/html
@@ -264,6 +270,10 @@ spec:
exec php-fpm -F
ports:
- containerPort: 9000 # PHP-FPMは9000ポートでリッスン
{{- with .Values.resources.phpfpm }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
# PVCルートを /var/www にマウント
# - /var/www/html のみ nginx が公開(nginx側は html サブパスだけをマウント)
@@ -306,6 +316,14 @@ spec:
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
{{- if .Values.selenium.enabled }}
# Selenium は別 Deployment/Service(templates/deployment-selenium.yaml)として
# 稼働する(v8.5.10-b 以降。selenium.enabled=true の Pod と同居させない設計に変更)。
# phpEnv に SELENIUM_URL を書いても、この行が env リストの後方にあるため
# 最終的にこちらが優先される(Kubernetes は同名 env の重複時、後方の値を採用する)。
- name: SELENIUM_URL
value: "http://{{ include "phpfpm.fullname" . }}-selenium:4444/wd/hub"
{{- end }}
{{- with .Values.extraEnv }}
{{- toYaml . | nindent 12 }}
{{- end }}
@@ -313,17 +331,6 @@ spec:
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.selenium.enabled }}
- name: selenium
image: "{{ .Values.image.selenium.registry }}/{{ .Values.image.selenium.repository }}:{{ .Values.image.selenium.tag }}"
imagePullPolicy: {{ .Values.image.selenium.pullPolicy }}
ports:
- containerPort: 4444 # Selenium用ポート
volumeMounts:
- name: app-storage
mountPath: /var/www/html
subPath: html
{{- end }}
dnsPolicy: ClusterFirst
dnsConfig:
options: