feat: statefulsets
This commit is contained in:
113
deployment/echo.yaml
Normal file
113
deployment/echo.yaml
Normal file
@ -0,0 +1,113 @@
|
||||
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
|
@ -7,6 +7,7 @@ docker run \
|
||||
--restart=always \
|
||||
-e SSL_CERT_DIR=/apps/ssl \
|
||||
--add-host raw.githubusercontent.com:185.199.109.133 \
|
||||
-v ./data:/data \
|
||||
-p 20443:443 \
|
||||
-p 80:30080 \
|
||||
-p 443:30443 \
|
||||
|
Reference in New Issue
Block a user