# deployment.yaml — AIOps 应用 (embed 前端嵌入后端, 单容器单端口) # ---------------------------------------------------------------------------- # - 镜像 aiops:embed(前端通过 go:embed 内嵌进同一二进制) # - 单端口 8080 = API + WebSocket + 前端 SPA 静态资源 # - 配置: ConfigMap aiops-config 挂载到 /app/config.yaml # - Service: NodePort 30080 → 8080 # # 部署: kubectl apply -f deployment.yaml # ---------------------------------------------------------------------------- --- apiVersion: apps/v1 kind: Deployment metadata: name: aiops namespace: devops labels: app.kubernetes.io/name: aiops app.kubernetes.io/component: app spec: replicas: 1 strategy: type: RollingUpdate rollingUpdate: maxSurge: 1 maxUnavailable: 0 selector: matchLabels: app.kubernetes.io/name: aiops app.kubernetes.io/component: app template: metadata: labels: app.kubernetes.io/name: aiops app.kubernetes.io/component: app spec: hostNetwork: true dnsPolicy: ClusterFirstWithHostNet containers: - name: aiops image: aiops-aiops:latest imagePullPolicy: IfNotPresent ports: - name: http containerPort: 8080 env: - name: TZ value: Asia/Shanghai volumeMounts: - name: config mountPath: /app/config.yaml subPath: config.yaml readOnly: true - name: uploads mountPath: /app/uploads - name: data mountPath: /app/data readinessProbe: httpGet: path: /version port: 8080 initialDelaySeconds: 5 periodSeconds: 10 timeoutSeconds: 3 livenessProbe: httpGet: path: /version port: 8080 initialDelaySeconds: 15 periodSeconds: 30 timeoutSeconds: 5 resources: requests: cpu: 100m memory: 256Mi limits: cpu: "1" memory: 1Gi volumes: - name: config configMap: name: aiops-config - name: uploads emptyDir: {} - name: data emptyDir: {} --- apiVersion: v1 kind: Service metadata: name: aiops namespace: devops labels: app.kubernetes.io/name: aiops spec: type: NodePort selector: app.kubernetes.io/name: aiops app.kubernetes.io/component: app ports: - name: http port: 8080 targetPort: 8080 nodePort: 30080 protocol: TCP