k8s安装YAPI

本文涉及的产品
容器服务 Serverless 版 ACK Serverless,952元额度 多规格
容器服务 Serverless 版 ACK Serverless,317元额度 多规格
简介: k8s安装YAPI

一、前置条件

提前安装MongoDB

二、YAML文件

namespace 自行替换

Deployment.yaml

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

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配置文件,根据实际情况填写)  

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

apiVersion: v1

data:

  config.json: |-

    {

       "closeRegister":true,

       "port""3000",

       "adminAccount""example@xxx.com",

       "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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

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


相关实践学习
通过Ingress进行灰度发布
本场景您将运行一个简单的应用,部署一个新的应用用于新的发布,并通过Ingress能力实现灰度发布。
容器应用与集群管理
欢迎来到《容器应用与集群管理》课程,本课程是“云原生容器Clouder认证“系列中的第二阶段。课程将向您介绍与容器集群相关的概念和技术,这些概念和技术可以帮助您了解阿里云容器服务ACK/ACK Serverless的使用。同时,本课程也会向您介绍可以采取的工具、方法和可操作步骤,以帮助您了解如何基于容器服务ACK Serverless构建和管理企业级应用。 学习完本课程后,您将能够: 掌握容器集群、容器编排的基本概念 掌握Kubernetes的基础概念及核心思想 掌握阿里云容器服务ACK/ACK Serverless概念及使用方法 基于容器服务ACK Serverless搭建和管理企业级网站应用
相关文章
|
3天前
|
Kubernetes 应用服务中间件 nginx
Kubernetes上安装Metallb和Ingress并部署应用程序
Kubernetes上安装Metallb和Ingress并部署nginx应用程序,使用LoadBalancer类型的KubernetesService
27 2
|
17天前
|
Kubernetes 数据库 容器
k8s安装seata单机版
k8s安装seata单机版
|
17天前
|
消息中间件 Kubernetes 容器
k8s安装rabbbitmq
k8s安装rabbbitmq
|
17天前
|
Kubernetes 关系型数据库 MySQL
k8s安装并迁移jumpserver
k8s安装并迁移jumpserver
|
1月前
|
存储 Kubernetes 容器
Kubernetes(K8S) kubesphere 安装
Kubernetes(K8S) kubesphere 安装
50 4
|
1月前
|
Kubernetes Linux Docker
Kubernetes(K8S) helm 安装
Kubernetes(K8S) helm 安装
27 1
|
17天前
|
Kubernetes 调度 容器
k8s descheduler 组件安装
k8s descheduler 组件安装
|
22天前
|
Kubernetes 安全 持续交付
在K8S中,二进制安装和Kubeadm安装有什么区别?
在K8S中,二进制安装和Kubeadm安装有什么区别?
|
27天前
|
Kubernetes 安全 搜索推荐
在K8S中,二进制与Kubeadm安装有何区别?
在K8S中,二进制与Kubeadm安装有何区别?
|
27天前
|
存储 Kubernetes 监控
在K8S中,集群安装过程有哪些?
在K8S中,集群安装过程有哪些?