网站可以做多语言的吗产品软文范例大全
k8s通过编排文件,实现服务的滚动更新
apiVersion: apps/v1
kind: pod
metadata:name: ‘servicename’labels:app: ‘servicename’
spec:replicas: 4 ##pod启动数量最少为2,不然滚动更新无意义strategy:type: RollingUpdate ##设置类型为滚动更新以及每次启动的最多pod数量rollingUpdate: ##设置类型为滚动更新以及每次启动的最多pod数量maxUnavailable: 25% ##设置类型为滚动更新以及每次启动的最多pod数量maxSurge: 25% ##设置类型为滚动更新以及每次启动的最多pod数量selector:matchLabels:app: ‘servicename’template:metadata:labels:app: ‘servicename’ctime: "20231204192836"spec:containers:- name: ‘servicename’image: 镜像地址imagePullPolicy: Alwayslifecycle: ##此处内容添加为下线控制内容,前端服务可不需要preStop: ##此处内容添加为下线控制内容,前端服务可不需要exec: ##此处内容添加为下线控制内容,前端服务可不需要command:##此处内容添加为下线控制内容,前端服务可不需要- 'sh'##此处内容添加为下线控制内容,前端服务可不需要- '-c'##此处内容添加为下线控制内容,前端服务可不需要- 'wget http://localhost/pms-framework-portal/service/deregister;sleep 30'##此处内容添加为下线控制内容,前端服务可不需要
##添加探针,对启动服务端的容器进行健康检测 readinessProbe: # 就绪探针tcpSocket:port: 80initialDelaySeconds: 10 # 第一次探测时等待10speriodSeconds: 10 # 每10s执行一次timeoutSeconds: 3 #单次执行超时时间livenessProbe: # 存活探针tcpSocket:port: 80initialDelaySeconds: 10 # 第一次探测时等待10stimeoutSeconds: 5 #单次执行超时时间periodSeconds: 30 #每30s执行一次successThreshold: 1 #成功阀值failureThreshold: 5 #失败阀值command:
##tini启动方式便于读取PID打印线程日志和内存日志等- /sbin/tini- java
##开启JDK感知容器分配资源limits- -XX:+UnlockExperimentalVMOptions- -XX:+UseCGroupMemoryLimitForHeap
##内存优化配置- -XX:InitialRAMPercentage=25.0- -XX:MinRAMPercentage=25.0- -XX:MaxRAMPercentage=75.0- -XX:MetaspaceSize=256M- -XX:MaxMetaspaceSize=512M
##内存溢出堆栈打印- -XX:+HeapDumpOnOutOfMemoryError- -XX:HeapDumpPath=/
##堆配置打印- -XshowSettings:vm
##GC配置- -XX:+UseG1GC- -XX:+PrintGCDetails- -XX:+PrintGCDateStamps- -XX:+PrintAdaptiveSizePolicy- -XX:+PrintTenuringDistribution- -Xloggc:gc.log
##线程优化配置- -Dserver.tomcat.prestartminSpareThreads=true- -Dserver.tomcat.minSpareThreads=20 - -Dserver.tomcat.maxThreads=500- -Dserver.tomcat.acceptCount=100- -Dserver.tomcat.maxIdelTime=60000- -Dserver.tomcat.enableLookups=false
##内嵌Tomcat请求大小限制,-1表示不限制- -Dserver.tomcat.maxPostSize=-1
以上内容,除了实现滚动更新,另外对服务做了内存、线程等优化