k8s部署DOClever

2018-07-03  本文已影响0人  苏州运维开发

开发组采用doclever进行开发文档规范管理,将服务运行在k8s集群中
1.先部署mongodb
vim mongodb-deployment.yaml

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: mongodb
spec:
   replicas: 1
   template:
     metadata:
       name: mongodb
       labels:
         app: mongodb
     spec:
       containers:
         - name: mongodb
           image: 172.21.205.57:5005/mongodb:latest
           ports:
             - name : mongodb
               containerPort: 27017
--
apiVersion: v1
kind: Service
metadata:
  name: mongodb-service
spec:
  ports:
    - port: 27017
      targetPort: 27017
      protocol: TCP
  selector:
    app: mongodb

2.DOClever服务

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: doclever
spec:
   replicas: 1
   template:
     metadata:
       name: doclever
       labels:
         app: doclever
     spec:
       containers:
         - name: doclever
           image: 172.21.205.57:5005/doclever:latest-ubuntu
           env:
           - name: DB_HOST
             value: "mongodb://mongodb-service:27017/DOClever"
           - name: PORT
             value: "10000"
           - name: DB_FILE
             value: "/root/DOClever/data/file"
           - name: DB_IMG
             value: "/root/DOClever/data/img"
           - name: DB_TEMP
             value: "/root/DOClever/data/tmp"
           ports:
             - name : doclever
               containerPort: 10000
--
apiVersion: v1
kind: Service
metadata:
  name: doclever-service
spec:
  ports:
    - port: 10000
      targetPort: 10000
      protocol: TCP
  selector:
    app: doclever

注意点:未做持久化,可以采用共享网络存储作为后端存储;mongodb需先部署。


image.png
上一篇下一篇

猜你喜欢

热点阅读