fix_de.sh 857 Bytes
#!/bin/bash

echo "=== 更新前端 Deployment 配置 ==="

echo "更新前端 Deployment 使用正确的 nginx 配置:"
kubectl patch deployment frontend -n ecommerce -p '{
  "spec": {
    "template": {
      "spec": {
        "volumes": [
          {
            "name": "nginx-config",
            "configMap": {
              "name": "frontend-nginx-config"
            }
          }
        ],
        "containers": [
          {
            "name": "frontend",
            "volumeMounts": [
              {
                "name": "nginx-config",
                "mountPath": "/etc/nginx/nginx.conf",
                "subPath": "nginx.conf"
              }
            ]
          }
        ]
      }
    }
  }
}'

echo ""
echo "等待部署更新..."
sleep 10

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