2022-02-26:k8s安装swagger,yaml如何写?

2022-03-04 15:22:34 浏览数 (1)

2022-02-26:k8s安装swagger,yaml如何写?

答案2022-02-26:

yaml如下:

代码语言:javascript复制
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: swagger
  name: swagger
  namespace: moonfdd
spec:
  replicas: 1
  selector:
    matchLabels:
      app: swagger
  template:
    metadata:
      labels:
        app: swagger
    spec:
      containers:
        - image: swaggerapi/swagger-ui
          imagePullPolicy: IfNotPresent
          name: swagger
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: swagger
  name: swagger
  namespace: moonfdd
spec:
  ports:
    - port: 8080
      protocol: TCP
      targetPort: 8080
  selector:
    app: swagger
  type: NodePort

结果如下:

0 人点赞