根因(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。
253 lines
8.6 KiB
YAML
253 lines
8.6 KiB
YAML
{{- $root := . }}
|
||
{{- $name := .Values.sso.name }}
|
||
{{- $role := .Values.sso.role }}
|
||
{{- $webName := printf "%s-web" $name }}
|
||
{{- $serviceId := .Values.sso.serviceId }}
|
||
{{- $database := .Values.sso.database }}
|
||
{{- $pgHost := printf "%s-postgres-service" $name }}
|
||
{{- $backendPort := .Values.sso.port | default 8080 }}
|
||
---
|
||
apiVersion: apps/v1
|
||
kind: Deployment
|
||
metadata:
|
||
name: {{ $name }}-deployment
|
||
labels:
|
||
app.kubernetes.io/name: mixingx
|
||
app.kubernetes.io/instance: {{ $root.Release.Name }}
|
||
app.kubernetes.io/component: {{ $name }}
|
||
spec:
|
||
replicas: {{ .Values.sso.replicas | default 2 }}
|
||
selector:
|
||
matchLabels:
|
||
app.kubernetes.io/component: {{ $name }}
|
||
template:
|
||
metadata:
|
||
annotations:
|
||
checksum/config: {{ include "mixingx-sso.configData" . | sha256sum }}
|
||
labels:
|
||
app.kubernetes.io/component: {{ $name }}
|
||
spec:
|
||
{{ include "mixingx-sso.tierAffinity" (dict "role" $role "root" $root) | nindent 6 }}
|
||
{{- with $.Values.imagePullSecrets }}
|
||
imagePullSecrets:
|
||
{{- toYaml . | nindent 8 }}
|
||
{{- end }}
|
||
containers:
|
||
- name: {{ $name }}
|
||
image: {{ $root.Values.registry }}/{{ $root.Values.images.sso.repository | default "sso" }}:{{ $root.Values.images.sso.tag | default $root.Values.tag | default "latest" }}
|
||
imagePullPolicy: IfNotPresent
|
||
securityContext:
|
||
appArmorProfile:
|
||
type: Unconfined
|
||
ports:
|
||
- name: http
|
||
containerPort: {{ $backendPort }}
|
||
protocol: TCP
|
||
envFrom:
|
||
- configMapRef:
|
||
name: {{ $name }}-config
|
||
- secretRef:
|
||
name: {{ $name }}-secrets
|
||
env:
|
||
- name: TZ
|
||
value: "{{ $root.Values.timezone | default "Asia/Shanghai" }}"
|
||
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: {{ $name }}-service
|
||
labels:
|
||
app.kubernetes.io/name: mixingx
|
||
app.kubernetes.io/component: {{ $name }}
|
||
mixingx.io/role: {{ $role }}
|
||
mixingx.io/node-id: {{ $name }}
|
||
annotations:
|
||
mixingx.io/description: {{ .Values.sso.description | quote }}
|
||
spec:
|
||
selector:
|
||
app.kubernetes.io/component: {{ $name }}
|
||
ports:
|
||
- name: http
|
||
port: {{ $backendPort }}
|
||
targetPort: http
|
||
protocol: TCP
|
||
---
|
||
apiVersion: v1
|
||
kind: ConfigMap
|
||
metadata:
|
||
name: {{ $name }}-config
|
||
data:
|
||
{{- include "mixingx-sso.configData" . | nindent 2 }}
|
||
---
|
||
apiVersion: v1
|
||
kind: Secret
|
||
metadata:
|
||
name: {{ $name }}-secrets
|
||
type: Opaque
|
||
stringData:
|
||
ConnectionStrings__redis: "{{ $root.Values.sharedInfra.redis.host }}:{{ $root.Values.sharedInfra.redis.port }},password={{ $root.Values.sharedInfra.redis.password }}"
|
||
REDIS_PASSWORD: "{{ $root.Values.sharedInfra.redis.password }}"
|
||
REDIS_URI: "redis://:{{ $root.Values.sharedInfra.redis.password }}@{{ $root.Values.sharedInfra.redis.host }}:{{ $root.Values.sharedInfra.redis.port }}"
|
||
{{- if $database }}
|
||
ConnectionStrings__PostgreSQL: "Host={{ $pgHost }};Port={{ $root.Values.sharedInfra.postgres.port }};Username={{ $root.Values.sharedInfra.postgres.username }};Password={{ $root.Values.sharedInfra.postgres.password }};Database={{ $database }}"
|
||
POSTGRESQL_PASSWORD: "{{ $root.Values.sharedInfra.postgres.password }}"
|
||
POSTGRESQL_URI: "postgresql://{{ $root.Values.sharedInfra.postgres.username }}:{{ $root.Values.sharedInfra.postgres.password }}@{{ $pgHost }}:{{ $root.Values.sharedInfra.postgres.port }}/{{ $database }}"
|
||
POSTGRESQL_DATABASENAME: "{{ $database }}"
|
||
{{- end }}
|
||
ConnectionStrings__messaging: "amqp://{{ $root.Values.sharedInfra.rabbitmq.username }}:{{ $root.Values.sharedInfra.rabbitmq.password }}@{{ $root.Values.sharedInfra.rabbitmq.host }}:{{ $root.Values.sharedInfra.rabbitmq.port }}"
|
||
MESSAGING_PASSWORD: "{{ $root.Values.sharedInfra.rabbitmq.password }}"
|
||
MESSAGING_URI: "amqp://{{ $root.Values.sharedInfra.rabbitmq.username }}:{{ $root.Values.sharedInfra.rabbitmq.password }}@{{ $root.Values.sharedInfra.rabbitmq.host }}:{{ $root.Values.sharedInfra.rabbitmq.port }}"
|
||
---
|
||
apiVersion: apps/v1
|
||
kind: Deployment
|
||
metadata:
|
||
name: {{ $webName }}-deployment
|
||
labels:
|
||
app.kubernetes.io/name: mixingx
|
||
app.kubernetes.io/instance: {{ $root.Release.Name }}
|
||
app.kubernetes.io/component: {{ $webName }}
|
||
spec:
|
||
replicas: {{ .Values.sso.replicas | default 2 }}
|
||
selector:
|
||
matchLabels:
|
||
app.kubernetes.io/component: {{ $webName }}
|
||
template:
|
||
metadata:
|
||
labels:
|
||
app.kubernetes.io/component: {{ $webName }}
|
||
spec:
|
||
{{ include "mixingx-sso.tierAffinity" (dict "role" "web" "root" $root) | nindent 6 }}
|
||
{{- with $.Values.imagePullSecrets }}
|
||
imagePullSecrets:
|
||
{{- toYaml . | nindent 8 }}
|
||
{{- end }}
|
||
containers:
|
||
- name: {{ $webName }}
|
||
image: {{ $root.Values.registry }}/{{ $root.Values.images.ssoWeb.repository | default "sso-web" }}:{{ $root.Values.images.ssoWeb.tag | default $root.Values.tag | default "latest" }}
|
||
imagePullPolicy: IfNotPresent
|
||
ports:
|
||
- name: http
|
||
containerPort: 80
|
||
protocol: TCP
|
||
env:
|
||
- name: TZ
|
||
value: "{{ $root.Values.timezone | default "Asia/Shanghai" }}"
|
||
- name: VITE_BASE_PATH
|
||
value: "{{ .Values.sso.webBasePath }}"
|
||
- name: PORT
|
||
value: "80"
|
||
---
|
||
apiVersion: v1
|
||
kind: Service
|
||
metadata:
|
||
name: {{ $webName }}-service
|
||
labels:
|
||
app.kubernetes.io/name: mixingx
|
||
app.kubernetes.io/component: {{ $webName }}
|
||
mixingx.io/role: web
|
||
mixingx.io/node-id: {{ $webName }}
|
||
spec:
|
||
selector:
|
||
app.kubernetes.io/component: {{ $webName }}
|
||
ports:
|
||
- name: http
|
||
port: 80
|
||
targetPort: http
|
||
protocol: TCP
|
||
---
|
||
apiVersion: apps/v1
|
||
kind: StatefulSet
|
||
metadata:
|
||
name: {{ $name }}-postgres
|
||
labels:
|
||
app.kubernetes.io/name: mixingx
|
||
app.kubernetes.io/component: {{ $name }}-postgres
|
||
spec:
|
||
serviceName: {{ $name }}-postgres-service
|
||
replicas: 1
|
||
selector:
|
||
matchLabels:
|
||
app.kubernetes.io/component: {{ $name }}-postgres
|
||
volumeClaimTemplates:
|
||
- metadata:
|
||
name: data
|
||
annotations:
|
||
helm.sh/resource-policy: keep
|
||
spec:
|
||
accessModes: ["ReadWriteOnce"]
|
||
storageClassName: {{ include "mixingx-sso.storageClassName" $root }}
|
||
resources:
|
||
requests:
|
||
storage: {{ .Values.sso.pgStorage | default "5Gi" }}
|
||
template:
|
||
metadata:
|
||
labels:
|
||
app.kubernetes.io/component: {{ $name }}-postgres
|
||
spec:
|
||
{{ include "mixingx-sso.tierAffinity" (dict "role" $role "root" $root) | nindent 6 }}
|
||
{{- with $.Values.imagePullSecrets }}
|
||
imagePullSecrets:
|
||
{{- toYaml . | nindent 8 }}
|
||
{{- end }}
|
||
# postgres 以专用用户直跑,绕过镜像内 gosu(新内核下 gosu 用户态死循环,
|
||
# 见工单: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: {{ $root.Values.sharedInfra.postgres.image | default "docker.io/library/postgres:17" }}
|
||
imagePullPolicy: IfNotPresent
|
||
env:
|
||
- name: POSTGRES_PASSWORD
|
||
value: "{{ $root.Values.sharedInfra.postgres.password }}"
|
||
- name: POSTGRES_DB
|
||
value: "{{ $database }}"
|
||
- name: POSTGRES_USER
|
||
value: "{{ $root.Values.sharedInfra.postgres.username }}"
|
||
- name: PGDATA
|
||
value: /var/lib/postgresql/data/pgdata
|
||
ports:
|
||
- name: tcp
|
||
containerPort: {{ $root.Values.sharedInfra.postgres.port }}
|
||
protocol: TCP
|
||
volumeMounts:
|
||
- name: data
|
||
mountPath: /var/lib/postgresql/data
|
||
---
|
||
apiVersion: v1
|
||
kind: Service
|
||
metadata:
|
||
name: {{ $name }}-postgres-service
|
||
labels:
|
||
app.kubernetes.io/name: mixingx
|
||
app.kubernetes.io/component: {{ $name }}-postgres
|
||
spec:
|
||
selector:
|
||
app.kubernetes.io/component: {{ $name }}-postgres
|
||
ports:
|
||
- name: tcp
|
||
port: {{ $root.Values.sharedInfra.postgres.port }}
|
||
targetPort: tcp
|
||
protocol: TCP
|