首页 > 其他分享 >k8s安装YAPI

k8s安装YAPI

时间:2023-02-13 10:59:38浏览次数:47  
标签:name yapi 安装 app YAPI 3000 k8s config port

一、前置条件

提前安装MongoDB

二、YAML文件

namespace 自行替换

Deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: yapi
  namespace: ops-share
  labels:
    app: yapi
    release: yapi
spec:
  selector:
    matchLabels:
      app: yapi
      release: yapi
  template:
    metadata:
      labels:
        app: yapi
        release: yapi
    spec:
      containers:
      - name: yapi
        image: registry.cn-hangzhou.aliyuncs.com/mq_basic/yapi:1.9.5

        command: ["node","server/app.js"]
        ports:
        - containerPort: 3000
          name: yapi
          protocol: TCP
        volumeMounts:
        - name: config
          mountPath: /yapi/config.json
          subPath: config.json
        resources:
          requests:
            cpu: 500m
            memory: 512Mi
          limits:
            cpu: 1000m
            memory: 1024Mi
      volumes:
      - name: config
        configMap:
          name: yapi-config

svc.yaml

apiVersion: v1
kind: Service
metadata:

  labels:
    app: yapi-svc
  name: yapi-svc
  namespace: ops-share

spec:

  ports:
  - name: http-3000
    port: 3000
    protocol: TCP
    targetPort: 3000
  selector:
    app: yapi
 

configMap.yaml(即config.json,YAPI配置文件,根据实际情况填写)  

apiVersion: v1
data:
  config.json: |-
    {
       "closeRegister":true,
       "port": "3000",
       "adminAccount": "[email protected]",
       "db": {
          "servername": "10.0.0.112",
          "DATABASE": "yapi",
          "port": "27017",
          "user": "yapi",
          "pass": "yapi@123"
       },
       "mail": {
          "enable": false,
          "host": "smtp.163.com",
          "port": 465,
          "from": "***@163.com",
          "auth": {
             "user": "***@163.com",
             "pass": "*****"
          }
       }
    }
kind: ConfigMap
metadata:

  name: yapi-config
  namespace: ops-share
 

ingress.yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:

  name: yapi-inktech-ltd
  namespace: ops-share

spec:
  rules:
  - host: yapi.inktech.ltd
    http:
      paths:
      - backend:
          service:
            name: yapi-svc
            port:
              number: 3000
        path: /
        pathType: ImplementationSpecific
 

  

  

  

标签:name,yapi,安装,app,YAPI,3000,k8s,config,port
From: https://www.cnblogs.com/panwenbin-logs/p/17115572.html

相关文章

  • rabbitmq安装
    rabbitmq集群:erlang下载:erlang-23.3.4.10-1.el7.x86_64.rpmgithub下载erlang安装:yuminstall-yerlang-23.3.4.10-1.el7.x86_64.rpmrabbitmqserver安装:curl-shttps:......
  • k8s——调度与驱逐
    设置节点不可调度,逐台进行kubectlcordonxxx-node-01kubectlcordonxxx-node-02kubectlcordonxxx-node-03驱逐节点上的pod,逐台进行kubectldrainxxx-node-01-......
  • Keepalived安装与配置
    Keepalived的安装过程keepalived的安装非常简单,以操作系统环境Centos7为例,建议通过yum方式直接安装:yuminstallkeepalived如果需要lvs功能,还需要安装ipvs模块:yumins......
  • centos下安装部署nginx
    1.在安装Nginx之前,要确保已经安装了需要的软件:gcc、pcre-devel、zlib-devel、openssl-devel。如果没有安装,执行下面命令。  yum-yinstallgccpcre-develzlib-deve......
  • 使用kubeadm快速部署一个K8s集群
    kubeadm是官方社区推出的一个用于快速部署kubernetes集群的工具。这个工具能通过两条指令完成一个kubernetes集群的部署:#创建一个Master节点$kubeadminit#将一个Node......
  • 读懂下文,安装数据库不再求人
    想要数据存储必须要有数据库为支撑。在项目运行的时候也是要提前安装好并导入表结构和数据。通俗点来说,学会了万事不求人。这里就整理了一份关于Windows和Linux系统下安装......
  • K8S的基础概念
    一、Kubernetes介绍1、什么是Kubernetes?Kubernetes(通常称为K8s,K8s是将8个字母“ubernete”替换为“8”的缩写)是一个以容器为中心的基础架构,可以实现在物理集群或虚拟......
  • kubeadm部署安装+dashboard+harbor
    一、kubeadm部署1、环境准备12345678910111213141516171819202122232425262728293031323334353637383940414243444......
  • 一个容器,但是一整个k8s集群
    你可能需要一个快速启动和销毁的k8s集群;你可能在资源受限的环境中运行k8s集群;你可能是一个完全的初学者,觉得搭建完整的k8s套件太难。那么这篇短文可能可以帮到你。......
  • eclipse的下载及安装
    Eclipse下载 下载网址EclipseDownloads|TheEclipseFoundation Eclipse安装 找到下载的安装包点击进行安装 选择第二个 选择Java1.8所在目录和javaee......