re-deploy_ng.sh
1.31 KB
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
42
43
44
45
46
47
48
49
50
51
52
# 创建更新文件
cat > frontend-update.yaml << 'EOF'
apiVersion: apps/v1
kind: Deployment
metadata:
  name: frontend
  namespace: ecommerce
spec:
  template:
    spec:
      containers:
      - name: frontend
        image: 319998871902.dkr.ecr.us-east-1.amazonaws.com/ecommerce-frontend:1.1.2
        env:
        - name: NODE_ENV
          value: "production"
        - name: PORT
          value: "80"
        - name: API_BASE_URL
          value: "https://api.awsmpc.asia"
        - name: REACT_APP_API_URL
          value: "https://api.awsmpc.asia"
        volumeMounts:
        - 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
        livenessProbe:
          httpGet:
            path: /health
            port: 80
          initialDelaySeconds: 30
          periodSeconds: 10
        readinessProbe:
          httpGet:
            path: /health
            port: 80
          initialDelaySeconds: 5
          periodSeconds: 5
      volumes:
      - name: nginx-config
        configMap:
          name: frontend-config
      - name: environment-config
        configMap:
          name: frontend-config
EOF
# 应用更新
kubectl apply -f frontend-update.yaml