2022-02-27:k8s安装yapi,yaml如何写?
Posted 福大大架构师每日一题
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了2022-02-27:k8s安装yapi,yaml如何写?相关的知识,希望对你有一定的参考价值。
2022-02-27:k8s安装yapi,yaml如何写?
答案2022-02-27:
yaml如下:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: yapi
name: yapi
namespace: moonfdd
spec:
replicas: 1
selector:
matchLabels:
app: yapi
template:
metadata:
labels:
app: yapi
spec:
containers:
- env:
- name: MONGO_INITDB_ROOT_USERNAME
value: yapi
- name: MONGO_INITDB_ROOT_PASSWORD
value: admin.yapi
- name: MONGO_INITDB_DATABASE
value: yapi
image: 'mongo:latest'
imagePullPolicy: IfNotPresent
name: mongo
ports:
- containerPort: 27017
protocol: TCP
- env:
- name: YAPI_ADMIN_ACCOUNT
value: admin@qq.com
- name: YAPI_ADMIN_PASSWORD
value: admin123
- name: YAPI_CLOSE_REGISTER
value: 'false'
- name: YAPI_DB_SERVERNAME
value: 127.0.0.1
- name: YAPI_DB_PORT
value: '27017'
- name: YAPI_DB_DATABASE
value: yapi
- name: YAPI_DB_USER
value: yapi
- name: YAPI_DB_PASS
value: admin.yapi
- name: YAPI_DB_AUTH_SOURCE
value: admin
- name: YAPI_MAIL_ENABLE
value: 'true'
- name: YAPI_MAIL_HOST
value: smtp.exmail.qq.com
- name: YAPI_MAIL_PORT
value: '465'
- name: YAPI_MAIL_FROM
value: admin@qq.com
- name: YAPI_MAIL_AUTH_USER
value: xxx
- name: YAPI_MAIL_AUTH_PASS
value: xxx
- name: YAPI_LDAP_LOGIN_ENABLE
value: 'false'
image: 'jayfong/yapi:latest'
imagePullPolicy: IfNotPresent
name: yapi
---
apiVersion: v1
kind: Service
metadata:
labels:
app: yapi
name: yapi
namespace: moonfdd
spec:
ports:
- port: 3000
protocol: TCP
targetPort: 3000
selector:
app: yapi
type: NodePort
结果如下:
以上是关于2022-02-27:k8s安装yapi,yaml如何写?的主要内容,如果未能解决你的问题,请参考以下文章
2022-08-14:k8s安装PostgreSQL,yaml如何写?
2022-02-26:k8s安装swagger,yaml如何写?