k8s安装yapi,yaml如何写?
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@
- 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.
- name: YAPI_MAIL_PORT
value: '465'
- name: YAPI_MAIL_FROM
value: admin@
- 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
结果如下: