33.sh
974 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/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