用statefulSet 部署持久化的OA(Tomcat)

1.部署多个副本的OA(Tomcat)集群,其中一个Tomcat的需要加一个定时器,其他代码跟其他的Tomcat的代码一样。需要重启后也还是保持这个状态。代码如下:

apiVersion: v1
kind: Service
metadata:
name: wordpress0217
labels:
app: wordpress0217
spec:
ports:
- port: 80
clusterIP: None
selector:
app: wordpress0217
tier: frontend0217
---
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: wordpress0217
labels:
app: wordpress0217
spec:
serviceName: wordpress0217
replicas: 2
selector:
matchLabels:
app: wordpress0217
tier: frontend0217
template:
metadata:
labels:
app: wordpress0217
tier: frontend0217
spec:
containers:
- image: harbor.loveme.cn/pub/oatomcat:0220
name: wordpress0217
env:
- name: WORDPRESS_DB_HOST
value: wordpress0218-mysql
- name: WORDPRESS_DB_PASSWORD
value: engine2user
ports:
- containerPort: 8080
name: wordpress0217
volumeMounts:
- name: wordpress-persistent-storage
mountPath: /usr/local/tomcat/webapps/ROOT/
volumeClaimTemplates:
- metadata:
name: wordpress-persistent-storage
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: rook-ceph-block
resources:
requests:
storage: 20Gi

  

上一篇:Gradle 如何打包 Spring Boot 如何不添加版本代码


下一篇:赶时髦过了一遍Swift 语言....