Compare commits

...
Author SHA1 Message Date
薛佳帆 0a451f6070 fix(dotnet): 全部 .NET 主容器加 appArmorProfile Unconfined——AppArmor 拒线程定向信号致 GC abort
根因(dotnet/runtime#136603,已由同事在 sciveda 现场实测验证):Ubuntu 26.04 新内核
配套 AppArmor 行为禁止容器内进程向自身线程发信号(pthread_kill/tgkill → EACCES),
CoreCLR GC 挂起线程失败 → 运行时 abort → dmesg 表现为 'general protection fault
in libc.so.6[+0x289a2]'(.NET BGC/Server GC/TP Worker 线程),容器 exit 139
CrashLoop,负载越高崩得越频,且 journalctl 无 apparmor=DENIED 记录。
同机制亦解释此前 postgres 'could not signal for checkpoint: Permission denied'
(privileged 之所以有效 = privileged 容器不受 AppArmor 约束)。
修复:agent/sso/ultra/edge/gateway/platform 六处 .NET 主容器
securityContext.appArmorProfile.type: Unconfined。
2026-11-11 16:38:39 +08:00
薛佳帆 407aef89e1 fix(postgres): 全部 postgres StatefulSet 三件套修复——绕过镜像内 gosu 直跑 + 特权容器
根因:官方 postgres:17 镜像(2026-08 构建)内 gosu 在新内核(Ubuntu 26.04 kernel 7.0.0-39+)上
用户态死循环,容器假活(Running 但 5432 无服务、PGDATA 空、零日志);绕过 gosu 后 PG17 恢复期
signal checkpoint 再遇权限死循环,故三件缺一不可:
- pod securityContext: runAsUser/runAsGroup/fsGroup=999(以 postgres 用户直跑,跳过 gosu)
- container command: docker-entrypoint.sh postgres(非 root 下 entrypoint 自动跳过 gosu)
- container securityContext: privileged(否则恢复期 'could not signal for checkpoint: Permission denied')

涉及 5 个模板:sso/ultra/audit(audit-db)/platform(audit)/agent-unit 各自内嵌的 postgres。
实测:xjf1641(Xeon+kernel43)与 wytest(i5+kernel42)原始定义必死、打补丁后稳定运行;
kernel 7.0.0-38 老机(如 184)暂未触发但同机制不免疫,升级内核前必须先吃本修复。
2026-11-10 16:19:50 +08:00
8 changed files with 63 additions and 0 deletions

No files matched your search

@@ -81,6 +81,9 @@ spec:
- name: {{ $name }}
image: {{ include "mixingx-agent-unit.image" (dict "registry" .Values.global.imageRegistry "image" .Values.images.agent) | quote }}
imagePullPolicy: IfNotPresent
securityContext:
appArmorProfile:
type: Unconfined
ports:
- name: http
containerPort: {{ .Values.ports.backend }}
@@ -253,8 +256,17 @@ spec:
app.kubernetes.io/component: {{ $name }}-postgres
spec:
{{ include "mixingx-unit.followerScheduling" . | nindent 6 }}
# postgres 以专用用户直跑,绕过镜像内 gosu(新内核下 gosu 用户态死循环,
# 见 ADR/工单:kernel 7.0.0-39+ × gosu 兼容 bug;三件套缺一不可)
securityContext:
runAsUser: 999
runAsGroup: 999
fsGroup: 999
containers:
- name: postgres
command: ["docker-entrypoint.sh", "postgres"]
securityContext:
privileged: true
image: {{ include "mixingx-agent-unit.image" (dict "registry" .Values.global.imageRegistry "image" .Values.images.postgres) | quote }}
imagePullPolicy: IfNotPresent
env:
@@ -32,8 +32,17 @@ spec:
app.kubernetes.io/component: {{ .Values.audit.database }}-postgres
spec:
{{ include "mixingx-audit.tierAffinity" (dict "role" "audit" "root" $root) | nindent 6 }}
# postgres 以专用用户直跑,绕过镜像内 gosu(新内核下 gosu 用户态死循环,
# 见 ADR/工单:kernel 7.0.0-39+ × gosu 兼容 bug;三件套缺一不可)
securityContext:
runAsUser: 999
runAsGroup: 999
fsGroup: 999
containers:
- name: postgres
command: ["docker-entrypoint.sh", "postgres"]
securityContext:
privileged: true
image: {{ include "mixingx-audit.image" (dict "registry" $root.Values.global.imageRegistry "image" $root.Values.images.postgres) | quote }}
imagePullPolicy: IfNotPresent
env:
@@ -59,6 +59,9 @@ spec:
- name: {{ $name }}
image: {{ include "mixingx-edge-unit.image" (dict "registry" .Values.global.imageRegistry "image" .Values.images.edge) | quote }}
imagePullPolicy: IfNotPresent
securityContext:
appArmorProfile:
type: Unconfined
ports:
- name: http
containerPort: {{ .Values.ports.backend }}
@@ -30,6 +30,9 @@ spec:
- name: gateway
image: {{ include "mixingx-gateway.image" (dict "registry" .Values.global.imageRegistry "image" $gatewayImage) | quote }}
imagePullPolicy: IfNotPresent
securityContext:
appArmorProfile:
type: Unconfined
ports:
- name: http
containerPort: {{ .Values.gateway.port | default 8080 }}
@@ -30,6 +30,9 @@ spec:
{{ $image := index $root.Values.images .image }}
image: {{ include "mixingx-platform.image" (dict "registry" $root.Values.global.imageRegistry "image" $image) | quote }}
imagePullPolicy: IfNotPresent
securityContext:
appArmorProfile:
type: Unconfined
ports:
- name: http
containerPort: {{ $port }}
@@ -208,8 +208,17 @@ spec:
app.kubernetes.io/component: {{ .Values.audit.database }}-postgres
spec:
{{ include "mixingx-platform.tierAffinity" (dict "role" "audit" "root" $root) | nindent 6 }}
# postgres 以专用用户直跑,绕过镜像内 gosu(新内核下 gosu 用户态死循环,
# 见 ADR/工单:kernel 7.0.0-39+ × gosu 兼容 bug;三件套缺一不可)
securityContext:
runAsUser: 999
runAsGroup: 999
fsGroup: 999
containers:
- name: postgres
command: ["docker-entrypoint.sh", "postgres"]
securityContext:
privileged: true
image: {{ include "mixingx-platform.image" (dict "registry" $root.Values.global.imageRegistry "image" $root.Values.images.postgres) | quote }}
imagePullPolicy: IfNotPresent
env:
@@ -32,6 +32,9 @@ spec:
- name: {{ $name }}
image: {{ include "mixingx-sso.image" (dict "registry" $root.Values.global.imageRegistry "image" $root.Values.images.sso) | quote }}
imagePullPolicy: IfNotPresent
securityContext:
appArmorProfile:
type: Unconfined
ports:
- name: http
containerPort: {{ $backendPort }}
@@ -190,8 +193,17 @@ spec:
app.kubernetes.io/component: {{ $name }}-postgres
spec:
{{ include "mixingx-sso.tierAffinity" (dict "role" $role "root" $root) | nindent 6 }}
# postgres 以专用用户直跑,绕过镜像内 gosu(新内核下 gosu 用户态死循环,
# 见 ADR/工单:kernel 7.0.0-39+ × gosu 兼容 bug;三件套缺一不可)
securityContext:
runAsUser: 999
runAsGroup: 999
fsGroup: 999
containers:
- name: postgres
command: ["docker-entrypoint.sh", "postgres"]
securityContext:
privileged: true
image: {{ include "mixingx-sso.image" (dict "registry" $root.Values.global.imageRegistry "image" $root.Values.images.postgres) | quote }}
imagePullPolicy: IfNotPresent
env:
@@ -37,6 +37,9 @@ spec:
- name: {{ $name }}
image: {{ include "mixingx-ultra.image" (dict "registry" $root.Values.global.imageRegistry "image" $root.Values.images.ultra) | quote }}
imagePullPolicy: IfNotPresent
securityContext:
appArmorProfile:
type: Unconfined
ports:
- name: http
containerPort: {{ $port }}
@@ -193,8 +196,17 @@ spec:
app.kubernetes.io/component: {{ $name }}-postgres
spec:
{{ include "mixingx-ultra.tierAffinity" (dict "role" $role "root" $root) | nindent 6 }}
# postgres 以专用用户直跑,绕过镜像内 gosu(新内核下 gosu 用户态死循环,
# 见 ADR/工单:kernel 7.0.0-39+ × gosu 兼容 bug;三件套缺一不可)
securityContext:
runAsUser: 999
runAsGroup: 999
fsGroup: 999
containers:
- name: postgres
command: ["docker-entrypoint.sh", "postgres"]
securityContext:
privileged: true
image: {{ include "mixingx-ultra.image" (dict "registry" $root.Values.global.imageRegistry "image" $root.Values.images.postgres) | quote }}
imagePullPolicy: IfNotPresent
env: