22.sh 763 Bytes
#!/bin/bash

echo "=== 修复重复的 volumeMounts ==="

echo "问题: 前端 Pod 有两个 nginx 配置挂载点"
echo "删除错误的挂载点: /etc/nginx/nginx.conf"

echo ""
echo "修复 volumeMounts 配置:"
kubectl patch deployment frontend -n ecommerce --type='json' -p='[
  {
    "op": "replace",
    "path": "/spec/template/spec/containers/0/volumeMounts",
    "value": [
      {
        "name": "nginx-config",
        "mountPath": "/etc/nginx/conf.d/default.conf",
        "subPath": "nginx.conf"
      },
      {
        "name": "environment-config", 
        "mountPath": "/usr/share/nginx/html/env.js",
        "subPath": "environment.js"
      }
    ]
  }
]'

echo ""
echo "重启前端:"
kubectl rollout restart deployment frontend -n ecommerce