Kubernetes部署Yapi
简介
YApi 是高效、易用、功能强大的 api 管理平台,旨在为开发、产品、测试人员提供更优雅的接口管理服务。可以帮助开发者轻松创建、发布、维护 API,YApi 还为用户提供了优秀的交互体验,开发人员只需利用平台提供的接口数据写入工具以及简单的点击操作就可以实现接口的管理。
特性
- 基于 Json5 和 Mockjs 定义接口返回数据的结构和文档,效率提升多倍
- 扁平化权限设计,即保证了大型企业级项目的管理,又保证了易用性
- 类似 postman 的接口调试
- 自动化测试, 支持对 Response 断言
- MockServer 除支持普通的随机 mock 外,还增加了 Mock 期望功能,根据设置的请求过滤规则,返回期望数据
- 支持 postman, har, swagger 数据导入
- 免费开源,内网部署,信息再也不怕泄露了
部署
[root@k8s01 yapi]# cat mongo.yaml
---
apiVersion: v1
kind: Service
metadata:
name: mongo
namespace: tools-env
labels:
app: mongo
spec:
ports:
- port: 27017
targetPort: 27017
name: mongo
selector:
app: mongo
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mongo
namespace: tools-env
labels:
app: mongo
spec:
serviceName: mongo
replicas: 1
selector:
matchLabels:
app: mongo
template:
metadata:
labels:
app: mongo
spec:
imagePullSecrets:
- name: harborsecret
containers:
- name: mongo
image: harbor.xxxxx.cn/tools/mongo:latest
imagePullPolicy: IfNotPresent
resources:
limits:
cpu: 500m
memory: 1024Mi
requests:
cpu: 200m
memory: 512Mi
env:
- name: TZ
value: Asia/Shanghai
ports:
- name: mongo
containerPort: 27017
protocol: TCP
volumeMounts:
- name: mongo-pvc
mountPath: /data/db
volumeClaimTemplates:
- metadata:
name: mongo-pvc
spec:
accessModes: [ "ReadWriteMany" ]
storageClassName: managed-nfs-storage
resources:
requests:
storage: 50Gi
[root@k8s01 yapi]# cat yapi.yaml
---
apiVersion: v1
kind: Service
metadata:
name: yapi
namespace: tools-env
labels:
app: yapi
spec:
ports:
- port: 3000
targetPort: 3000
name: yapi
nodePort: 33000
type: NodePort
selector:
app: yapi
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: yapi
name: yapi
namespace: tools-env
spec:
replicas: 1
selector:
matchLabels:
app: yapi
strategy: {}
template:
metadata:
labels:
app: yapi
spec:
imagePullSecrets:
- name: harborsecret
containers:
- env:
- name: YAPI_ADMIN_ACCOUNT
value: admin@xxxxx.cn
- name: YAPI_ADMIN_PASSWORD
value: 123456
- name: YAPI_CLOSE_REGISTER
value: "true"
- name: YAPI_DB_DATABASE
value: yapi
- name: YAPI_DB_PORT
value: "27017"
- name: YAPI_DB_SERVERNAME
value: mongo
- name: YAPI_LDAP_LOGIN_ENABLE
value: "false"
- name: YAPI_MAIL_AUTH_PASS
value: 123456
- name: YAPI_MAIL_AUTH_USER
value: yapi@xxxxx.cn
- name: YAPI_MAIL_ENABLE
value: "true"
- name: YAPI_MAIL_FROM
value: yapi@xxxxx.cn
- name: YAPI_MAIL_HOST
value: mail.xxxxx.cn
- name: YAPI_MAIL_PORT
value: "25"
- name: YAPI_PLUGINS
value: '[]'
image: harbor.xxxxx.cn/tools/yapi:latest
name: yapi-web
ports:
- containerPort: 3000
resources:
limits:
cpu: 500m
memory: 1024Mi
requests:
cpu: 200m
memory: 512Mi
restartPolicy: Always
登录后如下图:
版权声明:
本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自
爱吃可爱多!
喜欢就支持一下吧
打赏
微信
支付宝