首页 > 其他分享 >yapi 部署k8s

yapi 部署k8s

时间:2024-08-07 16:20:39浏览次数:17  
标签:mongo yapi 部署 app metadata k8s spec name

apiVersion: v1
kind: Namespace
metadata:
  name: yapi-ns
---
apiVersion: v1
kind: Service
metadata:
  name: mongo
  namespace: yapi-ns
  labels:
    app: mongo
spec:
  ports:
    - port: 27017
      targetPort: 27017
      name: mongo
  selector:
    app: mongo
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: mongo
  namespace: yapi-ns
  labels:
    app: mongo
spec:
  serviceName: mongo
  selector:
    matchLabels:
      app: mongo
  template:
    metadata:
      labels:
        app: mongo
    spec:
      imagePullSecrets:
      - name: registry-pull-secret
      containers:
        - name: mongo
          image: mongo
          imagePullPolicy: IfNotPresent
          resources:
            limits:
              cpu: 500m
              memory: 1024Mi
            requests:
              cpu: 200m
              memory: 512Mi
          env:
          - name: TZ
            value: Asia/Shanghai
          - name: MONGO_INITDB_DATABASE
            value: yapi
          - name: MONGO_INITDB_ROOT_USERNAME
            value: yapipro
          - name: MONGO_INITDB_ROOT_PASSWORD
            value: yapipro1024
          ports:
          - name: mongo
            containerPort: 27017
            protocol: TCP
          volumeMounts:
          - name: mongo-pvc
            mountPath: /data/db
  volumeClaimTemplates:
  - metadata:
      name: mongo-pvc
    spec:
      accessModes: [ "ReadWriteMany" ]  
      storageClassName: "nfs-client"  
      resources:
        requests:
          storage: 2Gi
---
apiVersion: v1
kind: Service
metadata:
  name: yapi
  namespace: yapi-ns
  labels:
    app: yapi
spec:
  ports:
    - port: 32368
      targetPort: 3000
      name: yapi
      nodePort: 32368
  type: NodePort
  selector:
    app: yapi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: yapi
  namespace: yapi-ns
  labels:
    app: yapi
spec:
  selector:
    matchLabels:
      app: yapi
  template:
    metadata:
      labels:
        app: yapi
    spec:
      containers:
      - name: yapi-init
        ports:
        - containerPort: 3000
        image: yapipro/yapi
        imagePullPolicy: IfNotPresent
        command: ["/bin/sh","-c", "echo $config > /yapi/config.json && node server/install.js"]
        env:
          - name: config
            value: | 
              {
                "port": "3000",
                "adminAccount": "[email protected]",
                "timeout":120000,
                "db": {
                  "servername": "mongo",
                  "DATABASE": "yapi",
                  "port": 27017,
                  "user": "yapi",
                  "pass": "yapi123456",
                  "authSource": ""
                },
                "mail": {
                  "enable": true,
                  "host": "smtp.gmail.com",
                  "port": 465,
                  "from": "*",
                  "auth": {
                    "user": "[email protected]",
                    "pass": "xxx"
                  }
                }
              }
---              
apiVersion: apps/v1
kind: Deployment
metadata:
  name: yapi
  namespace: yapi-ns
  labels:
    app: yapi
spec:
  selector:
    matchLabels:
      app: yapi
  template:
    metadata:
      labels:
        app: yapi
    spec:
      containers:
      - name: yapi-init
        ports:
        - containerPort: 3000
        image: yapipro/yapi
        imagePullPolicy: IfNotPresent
        command: ["/bin/sh","-c", "echo $config > /yapi/config.json && server/app.js"]
        env:
          - name: config
            value: | 
              {
                "port": "3000",
                "adminAccount": "[email protected]",
                "timeout":120000,
                "db": {
                  "servername": "mongo",
                  "DATABASE": "yapi",
                  "port": 27017,
                  "user": "yapi",
                  "pass": "yapi123456",
                  "authSource": ""
                },
                "mail": {
                  "enable": true,
                  "host": "smtp.gmail.com",
                  "port": 465,
                  "from": "*",
                  "auth": {
                    "user": "[email protected]",
                    "pass": "xxx"
                  }
                }
              }

  docker run   --entrypint sh  -it yapipro/yapi    entrypint  要写在前面

标签:mongo,yapi,部署,app,metadata,k8s,spec,name
From: https://www.cnblogs.com/qgbo/p/18347245

相关文章

  • 部署nuxt3.js到nginx的过程
    1.先安装好nodejs的版本我centos7版本,最后发现支持nodejs-v16.20版本在[sytyuser1@syit-dev-linux-01node]$pwd/usr/local/node在 /usr/local/node  目录下载wgethttps://nodejs.org/dist/latest-v16.x/node-v16.20.2-linux-x64.tar.gz解压 tar-zxvf node-v16.20.......
  • k8s学习笔记之CoreDNS
    一、CoreDNSconfigMap配置参数及说明主要讲解CoreDNSconfigMap及其他关键配置部署文件(需要替换其中一些变量):https://github.com/kubernetes/kubernetes/blob/master/cluster/addons/dns/coredns/coredns.yaml.base1.configMap配置apiVersion:v1kind:ConfigMapmetadat......
  • 简单项目部署流程
    本次项目部署至公司内网服务器上,内网IP为192.168.xx.xxx。项目打包:打包前可能要对项目的改动:配置文件中端口号,数据库等信息。​通过Maven的package打包成jar文件,其存放于项目的target文件夹下。将jar包复制到服务器的文件夹中,在其目录中cmd输入命令java-jarxxx.jar保......
  • 部署argo-rollouts
    https://github.com/argoproj/argo-rollouts/releaseskubectlcreatenamespaceargo-rolloutskubectlapply-nargo-rollouts-fhttps://github.com/argoproj/argo-rollouts/releases/download/v1.3.1/install.yamlkubectlapply-fhttps://github.com/argoproj/argo-r......
  • QWen2-72B-Instruct模型安装部署过程
    最近在给我们的客户私有化部署我们的TorchV系统,客户给的资源足够充裕,借此机会记录下部署千问72B模型的过程,分享给大家!一、基础信息操作系统:Ubuntu22.04.3LTSGPU:A800(80GB)*8内存:1TB二、软件信息Python:3.10Pytorch:2.3.0Transformers:4.43.0vLLM:0.5.0cuda:......
  • Jenkins部署手册
    一、概述Jenkins是一个持续集成环境,底层由Java开发,它的工作流程可以看作:1、从服务器拉下源代码到本地2、恢复相关程序包nuget3、MSBuild编译程序4、发布程序 二、安装在测试服务器212中依次安装SVN、JDK、VisualStudio、Jenkins,安装包如图:  配置环境变量、安装过......
  • 基于SpringBoot+Vue+uniapp的电动车租赁网站(源码+lw+部署文档+讲解等)
    文章目录前言详细视频演示具体实现截图技术栈后端框架SpringBoot前端框架Vue持久层框架MyBaitsPlus系统测试系统测试目的系统功能测试系统测试结论为什么选择我代码参考数据库参考源码获取前言......
  • 基于SpringBoot+Vue+uniapp的园区停车管理系统(源码+lw+部署文档+讲解等)
    文章目录前言详细视频演示具体实现截图技术栈后端框架SpringBoot前端框架Vue持久层框架MyBaitsPlus系统测试系统测试目的系统功能测试系统测试结论为什么选择我代码参考数据库参考源码获取前言......
  • 基于SpringBoot+Vue+uniapp的人力资源管理系统(源码+lw+部署文档+讲解等)
    文章目录前言详细视频演示具体实现截图技术栈后端框架SpringBoot前端框架Vue持久层框架MyBaitsPlus系统测试系统测试目的系统功能测试系统测试结论为什么选择我代码参考数据库参考源码获取前言......
  • 基于SpringBoot+Vue+uniapp的应急资源管理系统(源码+lw+部署文档+讲解等)
    文章目录前言详细视频演示具体实现截图技术栈后端框架SpringBoot前端框架Vue持久层框架MyBaitsPlus系统测试系统测试目的系统功能测试系统测试结论为什么选择我代码参考数据库参考源码获取前言......