yapi 部署k8s
2024-08-07 16:14 qgbo 阅读(8) 评论(0) 编辑 收藏 举报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": "hexiaohei1024@gmail.com", "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": "hexiaohei1024@gmail.com", "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": "hexiaohei1024@gmail.com", "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": "hexiaohei1024@gmail.com", "pass": "xxx" } } }
docker run --entrypoint sh -it yapipro/yapi #entrypint 要写在前面
docker run --entrypoint "/bin/sh" -it --rm f42f7299bbef
气功波(18037675651)