114 lines
2.2 KiB
YAML
114 lines
2.2 KiB
YAML
|
apiVersion: v1
|
|||
|
kind: Namespace
|
|||
|
metadata:
|
|||
|
name: echo-app
|
|||
|
|
|||
|
---
|
|||
|
apiVersion: apps/v1
|
|||
|
kind: StatefulSet
|
|||
|
metadata:
|
|||
|
namespace: echo-app
|
|||
|
name: echo
|
|||
|
spec:
|
|||
|
replicas: 1
|
|||
|
selector:
|
|||
|
matchLabels:
|
|||
|
app: echo
|
|||
|
template:
|
|||
|
metadata:
|
|||
|
labels:
|
|||
|
app: echo
|
|||
|
spec:
|
|||
|
containers:
|
|||
|
- name: system
|
|||
|
image: loveuer/echo_app:v0.0.1
|
|||
|
imagePullPolicy: IfNotPresent
|
|||
|
command: ["/app/echo_app"]
|
|||
|
ports:
|
|||
|
- containerPort: 80
|
|||
|
resources:
|
|||
|
limits:
|
|||
|
memory: 60Mi
|
|||
|
cpu: 1
|
|||
|
volumeMounts:
|
|||
|
- mountPath: /data
|
|||
|
name: echo-data
|
|||
|
volumes:
|
|||
|
- name: echo-data
|
|||
|
persistentVolumeClaim:
|
|||
|
claimName: echo-pvc
|
|||
|
|
|||
|
---
|
|||
|
apiVersion: v1
|
|||
|
kind: PersistentVolumeClaim
|
|||
|
metadata:
|
|||
|
namespace: echo-app
|
|||
|
name: echo-pvc
|
|||
|
spec:
|
|||
|
accessModes: ["ReadWriteMany"]
|
|||
|
storageClassName: "echo-storage"
|
|||
|
resources:
|
|||
|
requests:
|
|||
|
storage: 1Gi
|
|||
|
|
|||
|
---
|
|||
|
apiVersion: v1
|
|||
|
kind: PersistentVolume
|
|||
|
metadata:
|
|||
|
namespace: echo-app
|
|||
|
name: echo-pv
|
|||
|
spec:
|
|||
|
capacity:
|
|||
|
storage: 1Gi
|
|||
|
volumeMode: Filesystem # Filesystem(文件系统) Block(块)
|
|||
|
accessModes:
|
|||
|
- ReadWriteMany
|
|||
|
# persistentVolumeReclaimPolicy: Delete
|
|||
|
persistentVolumeReclaimPolicy: Retain
|
|||
|
hostPath:
|
|||
|
path: /data/echo-app
|
|||
|
type: ''
|
|||
|
storageClassName: "echo-storage"
|
|||
|
volumeMode: Filesystem
|
|||
|
---
|
|||
|
apiVersion: v1
|
|||
|
kind: Service
|
|||
|
metadata:
|
|||
|
namespace: echo-app
|
|||
|
name: echo
|
|||
|
# annotations:
|
|||
|
# metallb.universe.tf/loadBalancerIPs: 10.220.10.48
|
|||
|
spec:
|
|||
|
selector:
|
|||
|
app: echo
|
|||
|
# type: LoadBalancer
|
|||
|
type: ClusterIP
|
|||
|
ports:
|
|||
|
- name: echo-http
|
|||
|
port: 80
|
|||
|
targetPort: 80
|
|||
|
# nodePort: 31997
|
|||
|
|
|||
|
---
|
|||
|
apiVersion: networking.k8s.io/v1
|
|||
|
kind: Ingress
|
|||
|
metadata:
|
|||
|
name: ing-echo
|
|||
|
namespace: echo-app
|
|||
|
annotations:
|
|||
|
nginx.ingress.kubernetes.io/ssl-redirect: "false"
|
|||
|
nginx.ingress.kubernetes.io/use-regex: "true"
|
|||
|
spec:
|
|||
|
ingressClassName: nginx
|
|||
|
rules:
|
|||
|
- host: "echo.zyp.dev.com"
|
|||
|
http:
|
|||
|
paths:
|
|||
|
- path: /
|
|||
|
pathType: Prefix
|
|||
|
backend:
|
|||
|
service:
|
|||
|
name: echo
|
|||
|
port:
|
|||
|
number: 80
|