作者 yangfu

修改k8s配置

[dev-online]
#Ali could
#AccessKeyID ="LTAI4FhiZ3UktC6N1u3H5GFC"
#AccessKeySecret ="UyspWwdni55CYQ02hUCint4qY2jNYO"
AccessKeyID ="LTAI4Fz1LUBW2fXp6QWaJHRS"
AccessKeySecret ="aLZXwK8pgrs10Ws03qcN7NsrSXFVsg"
#日志
log_level = "${LOG_LEVEL||debug}"
aliyun_logs_access ="${aliyun_logs_access||F:/log/app.log}"
#Ali could
AccessKeyID ="LTAI4Fz1LUBW2fXp6QWaJHRS"
AccessKeySecret ="aLZXwK8pgrs10Ws03qcN7NsrSXFVsg"
#阿里云
#cname ="https://media.goexample.live/"
cname ="https://media.fjmaimaimai.com/"
... ...
[prod]
#Ali could
#AccessKeyID ="LTAI4FhiZ3UktC6N1u3H5GFC"
#AccessKeySecret ="UyspWwdni55CYQ02hUCint4qY2jNYO"
AccessKeyID ="LTAI4Fz1LUBW2fXp6QWaJHRS"
AccessKeySecret ="aLZXwK8pgrs10Ws03qcN7NsrSXFVsg"
#日志
log_level = "${LOG_LEVEL||debug}"
aliyun_logs_access ="${aliyun_logs_access||F:/log/app.log}"
#Ali could
AccessKeyID ="LTAI4Fz1LUBW2fXp6QWaJHRS"
AccessKeySecret ="aLZXwK8pgrs10Ws03qcN7NsrSXFVsg"
#阿里云
#cname ="https://media.goexample.live/"
cname ="https://media.fjmaimaimai.com/"
\ No newline at end of file
... ...
[test]
#日志
log_level = "${LOG_LEVEL||debug}"
aliyun_logs_access ="${aliyun_logs_access||F:/log/app.log}"
#Ali could
AccessKeyID ="LTAI4FhiZ3UktC6N1u3H5GFC"
AccessKeySecret ="UyspWwdni55CYQ02hUCint4qY2jNYO"
\ No newline at end of file
AccessKeyID ="LTAI4Fz1LUBW2fXp6QWaJHRS"
AccessKeySecret ="aLZXwK8pgrs10Ws03qcN7NsrSXFVsg"
#阿里云
cname ="https://media.fjmaimaimai.com/"
\ No newline at end of file
... ...
... ... @@ -84,8 +84,6 @@ spec:
configMapKeyRef:
name: suplus-config
key: mysql.password
- name: MYSQL_DB_NAME
value: "opportunity_dev"
- name: RUN_MODE
value: "dev-online"
- name: LOG_LEVEL
... ...
#!/bin/bash
export PATH=/root/local/bin:$PATH
kubectl -n mmm-suplus-prd get pods | grep -q mmmopp
kubectl -n mmm-suplus-prd get pods | grep -q mmm-open-api
if [ "$?" == "1" ];then
kubectl create -f /tmp/prd/mmm-go-opp/opp.yaml --record
kubectl -n mmm-suplus-prd get svc | grep -q mmmopp
kubectl create -f /tmp/prd/mmm-open-api/mmm-open-api.yaml --record
kubectl -n mmm-suplus-prd get svc | grep -q mmm-open-api
if [ "$?" == "0" ];then
echo "mmmopp service install success!"
echo "mmm-open-api service install success!"
else
echo "mmmopp service install fail!"
echo "mmm-open-api service install fail!"
fi
kubectl -n mmm-suplus-prd get pods | grep -q mmmopp
kubectl -n mmm-suplus-prd get pods | grep -q mmm-open-api
if [ "$?" == "0" ];then
echo "mmmopp deployment install success!"
echo "mmm-open-api deployment install success!"
else
echo "mmmopp deployment install fail!"
echo "mmm-open-api deployment install fail!"
fi
else
kubectl delete -f /tmp/prd/mmm-go-opp/opp.yaml
kubectl -n mmm-suplus-prd get svc | grep -q mmmopp
kubectl delete -f /tmp/prd/mmm-open-api/mmm-open-api.yaml
kubectl -n mmm-suplus-prd get svc | grep -q mmm-open-api
while [ "$?" == "0" ]
do
kubectl -n mmm-suplus-prd get svc | grep -q mmmopp
kubectl -n mmm-suplus-prd get svc | grep -q mmm-open-api
done
kubectl -n mmm-suplus-prd get pods | grep -q mmmopp
kubectl -n mmm-suplus-prd get pods | grep -q mmm-open-api
while [ "$?" == "0" ]
do
kubectl -n mmm-suplus-prd get pods | grep -q mmmopp
kubectl -n mmm-suplus-prd get pods | grep -q mmm-open-api
done
kubectl create -f /tmp/prd/mmm-go-opp/opp.yaml --record
kubectl -n mmm-suplus-prd get svc | grep -q mmmopp
kubectl create -f /tmp/prd/mmm-open-api/mmm-open-api.yaml --record
kubectl -n mmm-suplus-prd get svc | grep -q mmm-open-api
if [ "$?" == "0" ];then
echo "mmmopp service update success!"
echo "mmm-open-api service update success!"
else
echo "opp service update fail!"
echo "mmm-open-api service update fail!"
fi
kubectl -n mmm-suplus-prd get pods | grep -q opp
kubectl -n mmm-suplus-prd get pods | grep -q mmm-open-api
if [ "$?" == "0" ];then
echo "opp deployment update success!"
echo "mmm-open-api deployment update success!"
else
echo "opp deployment update fail!"
echo "mmm-open-api deployment update fail!"
fi
fi
\ No newline at end of file
... ...
apiVersion: v1
kind: Service
metadata:
name: mmmopenapi
namespace: mmm-suplus-dev
name: mmm-open-api
namespace: mmm-suplus-prd
labels:
k8s-app: mmmopenapi
k8s-app: mmm-open-api
spec:
ports:
- name: "http"
port: 80
targetPort: 8080
selector:
k8s-app: mmmopenapi
k8s-app: mmm-open-api
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: mmmopenapi
namespace: mmm-suplus-dev
name: mmm-open-api
namespace: mmm-suplus-prd
labels:
k8s-app: mmmopenapi
k8s-app: mmm-open-api
spec:
replicas: 1
template:
metadata:
labels:
k8s-app: mmmopenapi
k8s-app: mmm-open-api
spec:
affinity:
nodeAffinity:
... ... @@ -43,8 +43,8 @@ spec:
- cn-hangzhou.i-bp1euf5u1ph9kbhtndhb
- cn-hangzhou.i-bp1hyp5oips9cdwxxgxy
containers:
- name: mmmopenapi
image: 192.168.0.243:5000/mmm/mmmopenapi:dev
- name: mmm-open-api
image: 192.168.0.243:5000/mmm/mmm-open-api:dev
imagePullPolicy: Always
volumeMounts:
- mountPath: /opt/logs
... ... @@ -84,10 +84,8 @@ spec:
configMapKeyRef:
name: suplus-config
key: mysql.password
- name: MYSQL_DB_NAME
value: "opportunity_dev"
- name: RUN_MODE
value: "dev-online"
value: "prod"
- name: LOG_LEVEL
value: "debug"
- name: aliyun_logs_suplusfile
... ...
apiVersion: v1
kind: Service
metadata:
name: mmmopp
namespace: mmm-suplus-prd
labels:
k8s-app: mmmopp
spec:
ports:
- name: "http"
port: 80
targetPort: 8080
- name: "https"
port: 443
targetPort: 443
selector:
k8s-app: mmmopp
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: mmmopp
namespace: mmm-suplus-prd
labels:
k8s-app: mmmopp
spec:
replicas: 1
template:
metadata:
labels:
k8s-app: mmmopp
spec:
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- preference: {}
weight: 100
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- cn-hangzhou.i-bp1djh1xn7taumbue1ze
- cn-hangzhou.i-bp1djh1xn7taumbue1zd
- cn-hangzhou.i-bp1euf5u1ph9kbhtndhb
- cn-hangzhou.i-bp1hyp5oips9cdwxxgxy
containers:
- name: mmmopp
image: 192.168.0.243:5000/mmm/mmmopp:master
imagePullPolicy: Always
volumeMounts:
- mountPath: /opt/logs
name: accesslogs
- mountPath: /var/www/opp/file
name: opportunity-pvc1
ports:
- containerPort: 8080
- containerPort: 443
env:
- name: MYSQL_HOST
valueFrom:
configMapKeyRef:
name: suplus-config
key: mysql.host
- name: MYSQL_PORT
valueFrom:
configMapKeyRef:
name: suplus-config
key: mysql.port
- name: REDIS_HOST
valueFrom:
configMapKeyRef:
name: suplus-config
key: redis.ip
- name: REDIS_PORT
valueFrom:
configMapKeyRef:
name: suplus-config
key: redis.port
- name: MYSQL_USER
valueFrom:
configMapKeyRef:
name: suplus-config
key: mysql.user
- name: MYSQL_PASSWORD
valueFrom:
configMapKeyRef:
name: suplus-config
key: mysql.password
- name: MYSQL_DB_NAME
value: "opportunity"
- name: RUN_MODE
value: "prod"
- name: LOG_LEVEL
value: "debug"
- name: aliyun_logs_suplusfile
value: "stdout"
- name: aliyun_logs_access
value: " /opt/logs/app.log"
volumes:
- name: accesslogs
emptyDir: {}
- name: opportunity-pvc1
persistentVolumeClaim:
claimName: opportunity-pvc5
\ No newline at end of file
#!/bin/bash
export PATH=/root/local/bin:$PATH
kubectl -n mmm-suplus-test get pods | grep -q mmmopp
kubectl -n mmm-suplus-test get pods | grep -q mmm-open-api
if [ "$?" == "1" ];then
kubectl create -f /tmp/test/mmm-go-opp/opp.yaml --record
kubectl -n mmm-suplus-test get svc | grep -q mmmopp
kubectl create -f /tmp/test/mmm-open-api/mmm-open-api.yaml --record
kubectl -n mmm-suplus-test get svc | grep -q mmm-open-api
if [ "$?" == "0" ];then
echo "mmmopp service install success!"
echo "mmm-open-api service install success!"
else
echo "mmmopp service install fail!"
echo "mmm-open-api service install fail!"
fi
kubectl -n mmm-suplus-test get pods | grep -q mmmopp
kubectl -n mmm-suplus-test get pods | grep -q mmm-open-api
if [ "$?" == "0" ];then
echo "mmmopp deployment install success!"
echo "mmm-open-api deployment install success!"
else
echo "mmmopp deployment install fail!"
echo "mmm-open-api deployment install fail!"
fi
else
kubectl delete -f /tmp/test/mmm-go-opp/opp.yaml
kubectl -n mmm-suplus-test get svc | grep -q mmmopp
kubectl delete -f /tmp/test/mmm-open-api/mmm-open-api.yaml
kubectl -n mmm-suplus-test get svc | grep -q mmm-open-api
while [ "$?" == "0" ]
do
kubectl -n mmm-suplus-test get svc | grep -q mmmopp
kubectl -n mmm-suplus-test get svc | grep -q mmm-open-api
done
kubectl -n mmm-suplus-test get pods | grep -q mmmopp
kubectl -n mmm-suplus-test get pods | grep -q mmm-open-api
while [ "$?" == "0" ]
do
kubectl -n mmm-suplus-test get pods | grep -q mmmopp
kubectl -n mmm-suplus-test get pods | grep -q mmm-open-api
done
kubectl create -f /tmp/test/mmm-go-opp/opp.yaml --record
kubectl -n mmm-suplus-test get svc | grep -q mmmopp
kubectl create -f /tmp/test/mmm-open-api/mmm-open-api.yaml --record
kubectl -n mmm-suplus-test get svc | grep -q mmm-open-api
if [ "$?" == "0" ];then
echo "mmmopp service update success!"
echo "mmm-open-api service update success!"
else
echo "opp service update fail!"
fi
... ...
apiVersion: v1
kind: Service
metadata:
name: mmmopp
name: mmm-open-api
namespace: mmm-suplus-test
labels:
k8s-app: mmmopp
k8s-app: mmm-open-api
spec:
ports:
- name: "http"
port: 80
targetPort: 8080
- name: "https"
port: 443
targetPort: 443
selector:
k8s-app: mmmopp
k8s-app: mmm-open-api
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: mmmopp
name: mmm-open-api
namespace: mmm-suplus-test
labels:
k8s-app: mmmopp
k8s-app: mmm-open-api
spec:
replicas: 1
template:
metadata:
labels:
k8s-app: mmmopp
k8s-app: mmm-open-api
spec:
affinity:
nodeAffinity:
... ... @@ -46,17 +43,16 @@ spec:
- cn-hangzhou.i-bp1euf5u1ph9kbhtndhb
- cn-hangzhou.i-bp1hyp5oips9cdwxxgxy
containers:
- name: mmmopp
image: 192.168.0.243:5000/mmm/mmmopp:dev
- name: mmm-open-api
image: 192.168.0.243:5000/mmm/mmm-open-api:dev
imagePullPolicy: Always
volumeMounts:
- mountPath: /opt/logs
name: accesslogs
- mountPath: /var/www/opp/file
name: mmmjihuitest2-pvc1
name: mmmjihuitest-pvc1
ports:
- containerPort: 8080
- containerPort: 443
env:
- name: MYSQL_HOST
valueFrom:
... ... @@ -88,8 +84,6 @@ spec:
configMapKeyRef:
name: suplus-config
key: mysql.password
- name: MYSQL_DB_NAME
value: "opportunity_test"
- name: RUN_MODE
value: "test"
- name: LOG_LEVEL
... ... @@ -101,6 +95,6 @@ spec:
volumes:
- name: accesslogs
emptyDir: {}
- name: mmmjihuitest2-pvc1
- name: mmmjihuitest-pvc1
persistentVolumeClaim:
claimName: mmmjihuitest2-pvc
\ No newline at end of file
claimName: mmmjihuitest-pvc
\ No newline at end of file
... ...