作者 Your Name

修改配置

1 -#!/bin/bash  
2 -export PATH=/root/local/bin:$PATH  
3 -kubectl -n mmm-suplus-dev get pods | grep -q sg-local-storage  
4 -if [ "$?" == "1" ];then  
5 - kubectl create -f /tmp/local/sg-local-storage/sg-storage.yaml --record  
6 - kubectl -n mmm-suplus-dev get svc | grep -q sg-local-storage  
7 - if [ "$?" == "0" ];then  
8 - echo "sg-local-storage service install success!"  
9 - else  
10 - echo "sg-local-storage service install fail!"  
11 - fi  
12 - kubectl -n mmm-suplus-dev get pods | grep -q sg-local-storage  
13 - if [ "$?" == "0" ];then  
14 - echo "sg-local-storage deployment install success!"  
15 - else  
16 - echo "sg-local-storage deployment install fail!"  
17 - fi  
18 -else  
19 - kubectl delete -f /tmp/local/sg-local-storage/sg-storage.yaml  
20 - kubectl -n mmm-suplus-dev get svc | grep -q sg-local-storage  
21 - while [ "$?" == "0" ]  
22 - do  
23 - kubectl -n mmm-suplus-dev get svc | grep -q sg-local-storage  
24 - done  
25 - kubectl -n mmm-suplus-dev get pods | grep -q sg-local-storage  
26 - while [ "$?" == "0" ]  
27 - do  
28 - kubectl -n mmm-suplus-dev get pods | grep -q sg-local-storage  
29 - done  
30 - kubectl create -f /tmp/local/sg-local-storage/sg-storage.yaml --record  
31 - kubectl -n mmm-suplus-dev get svc | grep -q sg-local-storage  
32 - if [ "$?" == "0" ];then  
33 - echo "sg-local-storage service update success!"  
34 - else  
35 - echo "sg-local-storage service update fail!"  
36 - fi  
37 - kubectl -n mmm-suplus-dev get pods | grep -q sg-local-storage  
38 - if [ "$?" == "0" ];then  
39 - echo "sg-local-storage deployment update success!"  
40 - else  
41 - echo "sg-local-storage deployment update fail!"  
42 - fi  
43 -fi  
1 -apiVersion: v1  
2 -kind: Service  
3 -metadata:  
4 - name: sg-local-storage  
5 - namespace: mmm-suplus-dev  
6 - labels:  
7 - k8s-app: sg-local-storage  
8 -spec:  
9 - ports:  
10 - - name: "http"  
11 - port: 80  
12 - targetPort: 8080  
13 - - name: "https"  
14 - port: 443  
15 - targetPort: 443  
16 - selector:  
17 - k8s-app: sg-local-storage  
18 ----  
19 -apiVersion: extensions/v1beta1  
20 -kind: Deployment  
21 -metadata:  
22 - name: sg-local-storage  
23 - namespace: mmm-suplus-dev  
24 - labels:  
25 - k8s-app: sg-local-storage  
26 -spec:  
27 - replicas: 1  
28 - template:  
29 - metadata:  
30 - labels:  
31 - k8s-app: sg-local-storage  
32 - spec:  
33 - affinity:  
34 - nodeAffinity:  
35 - preferredDuringSchedulingIgnoredDuringExecution:  
36 - - preference: {}  
37 - weight: 100  
38 - requiredDuringSchedulingIgnoredDuringExecution:  
39 - nodeSelectorTerms:  
40 - - matchExpressions:  
41 - - key: kubernetes.io/hostname  
42 - operator: In  
43 - values:  
44 - - cn-hangzhou.i-bp1djh1xn7taumbue1ze  
45 - - cn-hangzhou.i-bp1djh1xn7taumbue1zd  
46 - - cn-hangzhou.i-bp1euf5u1ph9kbhtndhb  
47 - - cn-hangzhou.i-bp1hyp5oips9cdwxxgxy  
48 - containers:  
49 - - name: sg-local-storage  
50 - image: 192.168.0.243:5000/mmm/sg-storage:local  
51 - imagePullPolicy: Always  
52 - ports:  
53 - - containerPort: 8080  
54 - - containerPort: 443  
55 - volumeMounts:  
56 - - mountPath: /opt/logs  
57 - name: accesslogs  
58 - - mountPath: /go/src/sg-storage/uploads  
59 - name: sgstorage-pvc1  
60 - env:  
61 - - name: LOG_LEVEL  
62 - value: "debug"  
63 - - name: LOG_FILE  
64 - value: "true"  
65 - - name: ERROR_BASE_CODE  
66 - value: "1"  
67 - - name: ERROR_BASE_CODE_MULTIPLE  
68 - value: "1000"  
69 - - name: POSTGRESQL_DB_NAME  
70 - value: "sg_storage_local"  
71 - - name: ENABLE_HTTPS  
72 - value: "true"  
73 - - name: POSTGRESQL_USER  
74 - valueFrom:  
75 - configMapKeyRef:  
76 - name: suplus-config  
77 - key: postgresql.user  
78 - - name: POSTGRESQL_PASSWORD  
79 - valueFrom:  
80 - configMapKeyRef:  
81 - name: suplus-config  
82 - key: postgresql.password  
83 - - name: POSTGRESQL_HOST  
84 - valueFrom:  
85 - configMapKeyRef:  
86 - name: suplus-config  
87 - key: postgresql.host  
88 - - name: POSTGRESQL_PORT  
89 - valueFrom:  
90 - configMapKeyRef:  
91 - name: suplus-config  
92 - key: postgresql.port  
93 - - name: REDIS_HOST  
94 - valueFrom:  
95 - configMapKeyRef:  
96 - name: suplus-config  
97 - key: redis.ip  
98 - - name: REDIS_PORT  
99 - valueFrom:  
100 - configMapKeyRef:  
101 - name: suplus-config  
102 - key: redis.port  
103 - volumes:  
104 - - name: accesslogs  
105 - emptyDir: {}  
106 - - name: sgstorage-pvc1  
107 - persistentVolumeClaim:  
108 - claimName: sgstorage-pvc