帮我写一个用k8s部署给yapi使用的mango的yaml
时间: 2023-05-23 13:07:10 浏览: 67
Sure, here is a YAML code for deploying Mango using Kubernetes (k8s):
```
apiVersion: apps/v1
kind: Deployment
metadata:
name: mango
spec:
selector:
matchLabels:
app: mango
replicas: 1
template:
metadata:
labels:
app: mango
spec:
containers:
- name: mango
image: mongo:3.4
ports:
- containerPort: 27017
volumeMounts:
- name: data
mountPath: /data/db
volumes:
- name: data
persistentVolumeClaim:
claimName: mongo-pvc
---
apiVersion: v1
kind: Service
metadata:
name: mango
spec:
selector:
app: mango
ports:
- name: mongo
protocol: TCP
port: 27017
targetPort: 27017
type: ClusterIP
```
This YAML file deploys a single replica of Mango on Kubernetes. It also provides a persistent volume claim for the MongoDB database, attached to a volume named `data`. Finally, it sets up a ClusterIP service for the Mango deployment, which can be used to access Mango from within the Kubernetes cluster.