Files
mixingx.hub.chart/release-charts/mixingx-gateway/templates/gateway.yaml
T
薛佳帆 bf0170aa26 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:24 +08:00

130 lines
4.5 KiB
YAML

{{- $gatewayImage := .Values.images.gateway -}}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: gateway-deployment
labels:
app.kubernetes.io/name: mixingx
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: gateway
mixingx.io/role: gateway
mixingx.io/node-id: gateway
spec:
replicas: {{ .Values.gateway.replicas | default 2 }}
selector:
matchLabels:
app.kubernetes.io/component: gateway
template:
metadata:
labels:
app.kubernetes.io/component: gateway
mixingx.io/role: gateway
mixingx.io/node-id: gateway
spec:
{{- if .Values.gateway.rbac }}
serviceAccountName: gateway-sa
{{- end }}
{{ include "mixingx-gateway.tierAffinity" (dict "role" "gateway" "root" $) | nindent 6 }}
{{- with $.Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: gateway
image: {{ .Values.registry }}/{{ $gatewayImage.repository | default "gateway" }}:{{ $gatewayImage.tag | default .Values.tag | default "latest" }}
imagePullPolicy: IfNotPresent
securityContext:
appArmorProfile:
type: Unconfined
ports:
- name: http
containerPort: {{ .Values.gateway.port | default 8080 }}
protocol: TCP
envFrom:
- configMapRef:
name: gateway-config
- secretRef:
name: gateway-secrets
env:
- name: TZ
value: "{{ .Values.timezone | default "Asia/Shanghai" }}"
{{- if .Values.gateway.rbac }}
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- end }}
livenessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: 120
periodSeconds: 30
timeoutSeconds: 15
failureThreshold: 12
readinessProbe:
httpGet:
path: /alive
port: http
initialDelaySeconds: 60
periodSeconds: 30
timeoutSeconds: 10
failureThreshold: 8
---
apiVersion: v1
kind: Service
metadata:
name: gateway-service
labels:
app.kubernetes.io/name: mixingx
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: gateway
mixingx.io/role: gateway
mixingx.io/node-id: gateway
spec:
selector:
app.kubernetes.io/component: gateway
ports:
- name: http
port: {{ .Values.gateway.port | default 8080 }}
targetPort: http
protocol: TCP
---
apiVersion: v1
kind: ConfigMap
metadata:
name: gateway-config
labels:
app.kubernetes.io/name: mixingx
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: gateway
data:
HTTP_PORTS: "{{ .Values.gateway.port | default 8080 }}"
REDIS_HOST: "{{ .Values.sharedInfra.redis.host }}"
REDIS_PORT: "{{ .Values.sharedInfra.redis.port }}"
MESSAGING_HOST: "{{ .Values.sharedInfra.rabbitmq.host }}"
MESSAGING_PORT: "{{ .Values.sharedInfra.rabbitmq.port }}"
MESSAGING_USERNAME: "{{ .Values.sharedInfra.rabbitmq.username }}"
OTEL_EXPORTER_OTLP_ENDPOINT: "{{ .Values.sharedInfra.otlp.endpoint }}"
OTEL_EXPORTER_OTLP_PROTOCOL: "{{ .Values.sharedInfra.otlp.protocol }}"
OTEL_SERVICE_NAME: "gateway"
ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true"
---
apiVersion: v1
kind: Secret
metadata:
name: gateway-secrets
labels:
app.kubernetes.io/name: mixingx
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: gateway
type: Opaque
stringData:
ConnectionStrings__redis: "{{ .Values.sharedInfra.redis.host }}:{{ .Values.sharedInfra.redis.port }},password={{ .Values.sharedInfra.redis.password }}"
REDIS_PASSWORD: "{{ .Values.sharedInfra.redis.password }}"
REDIS_URI: "redis://:{{ .Values.sharedInfra.redis.password }}@{{ .Values.sharedInfra.redis.host }}:{{ .Values.sharedInfra.redis.port }}"
ConnectionStrings__messaging: "amqp://{{ .Values.sharedInfra.rabbitmq.username }}:{{ .Values.sharedInfra.rabbitmq.password }}@{{ .Values.sharedInfra.rabbitmq.host }}:{{ .Values.sharedInfra.rabbitmq.port }}"
MESSAGING_PASSWORD: "{{ .Values.sharedInfra.rabbitmq.password }}"
MESSAGING_URI: "amqp://{{ .Values.sharedInfra.rabbitmq.username }}:{{ .Values.sharedInfra.rabbitmq.password }}@{{ .Values.sharedInfra.rabbitmq.host }}:{{ .Values.sharedInfra.rabbitmq.port }}"