33.sh 974 Bytes
#!/bin/bash

echo "=== 恢复使用原始的 frontend-config ==="

echo "检查原始的 frontend-config 配置:"
kubectl get configmap frontend-config -n ecommerce -o yaml | grep -A 5 "nginx.conf"

echo ""
echo "原始的 frontend-config 配置已经是正确的,恢复使用它:"
kubectl patch deployment frontend -n ecommerce -p '{
  "spec": {
    "template": {
      "spec": {
        "volumes": [
          {
            "name": "nginx-config",
            "configMap": {
              "name": "frontend-config"
            }
          }
        ],
        "containers": [
          {
            "name": "frontend", 
            "volumeMounts": [
              {
                "name": "nginx-config",
                "mountPath": "/etc/nginx/conf.d/default.conf",
                "subPath": "nginx.conf"
              }
            ]
          }
        ]
      }
    }
  }
}'

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