k8s helm Seata1.5.1
1.当前文章是基于上一篇文章写的:
k8s Seata1.5.1_hunheidaode的博客-CSDN博客
在上面添加了些许改动,只不过是用helm部署了,其余的操作还是跟上篇博文一样子的。
2.环境:k8s 、nfs环境 或是动态存储
nfs:
3.下载seta helm部署yaml文件:文件位于:不知道的可看上篇博文。
4.我只是改动了values.yaml与templates下的deployment.yaml
deployment.yaml 改动了最后几行:
有原来hostpath改为NFS存储:
完整配置文件:
apiVersion: apps/v1
kind: Deployment
metadata:
{{- if .Values.namespace }}
namespace: {{ .Values.namespace }}
{{- end}}
name: {{ include "seata-server.name" . }}
labels:
{{ include "seata-server.labels" . | indent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "seata-server.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "seata-server.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 8091
protocol: TCP
{{- if .Values.volume }}
volumeMounts:
{{- range .Values.volume }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
{{- end}}
{{- end}}
{{- if .Values.env }}
env:
{{- if .Values.env.seataIp }}
- name: SEATA_IP
value: {{ .Values.env.seataIp | quote }}
{{- end }}
{{- if .Values.env.seataPort }}
- name: SEATA_PORT
value: {{ .Values.env.seataPort | quote }}
{{- end }}
{{- if .Values.env.seataEnv }}
- name: SEATA_ENV
value: {{ .Values.env.seataEnv }}
{{- end }}
{{- if .Values.env.seataConfigName }}
- name: SEATA_CONFIG_NAME
value: {{ .Values.env.seataConfigName }}
{{- end }}
{{- if .Values.env.serverNode }}
- name: SERVER_NODE
value: {{ .Values.env.serverNode | quote }}
{{- end }}
{{- if .Values.env.storeMode }}
- name: STORE_MODE
value: {{ .Values.env.storeMode }}
{{- end }}
{{- end }}
{{- if .Values.volume }}
volumes:
{{- range .Values.volume }}
- name: {{ .name }}
nfs:
server: {{ .nfsServers }}
path: {{ .nfsPath }}
{{- end}}
{{- end}}
只是改动的这块:
{{- if .Values.volume }}
volumes:
{{- range .Values.volume }}
- name: {{ .name }}
nfs:
server: {{ .nfsServers }}
path: {{ .nfsPath }}
{{- end}}
{{- end}}
values.yaml 完整:
replicaCount: 1
namespace: default
image:
repository: seataio/seata-server
tag: 1.5.1
pullPolicy: IfNotPresent
service:
type: NodePort
port: 30091
nodePort: 30091
env:
seataPort: "8091"
storeMode: "file"
seataIp: "192.168.56.211"
seataConfigName: "file:/root/seata-config/registry/registry.conf"
volume:
- name: seata-config
mountPath: /seata-server/resources
nfsServers: 192.168.56.211
nfsPath: /data/k8s/resource
env的环境之前配置过但是没有起作用,可以不用写:
seataConfigName:后面的内容
把/seata-server/resources 下的文件挂载到
/data/k8s/resource下
把上篇博文的文件下的文件修改后上传到 /data/k8s/resource文件下:
application.yaml 也与上篇博文一样:
server:
port: 7091
spring:
application:
name: seata-server
logging:
config: classpath:logback-spring.xml
file:
path: ${user.home}/logs/seata
extend:
logstash-appender:
destination: 127.0.0.1:4560
kafka-appender:
bootstrap-servers: 127.0.0.1:9092
topic: logback_to_logstash
console:
user:
username: seata
password: seata
seata:
config:
# support: nacos 、 consul 、 apollo 、 zk 、 etcd3
type: nacos
nacos:
server-addr: 192.168.56.211:30683
namespace: public
group: SEATA_GROUP
username: nacos
password: nacos
##if use MSE Nacos with auth, mutex with username/password attribute
#access-key: ""
#secret-key: ""
data-id: seata.properties
registry:
# support: nacos 、 eureka 、 redis 、 zk 、 consul 、 etcd3 、 sofa
type: nacos
preferred-networks: 192.168.*
nacos:
application: seata-server
server-addr: 192.168.56.211:30683
group: SEATA_GROUP
namespace: public
cluster: default
username: nacos
password: nacos
##if use MSE Nacos with auth, mutex with username/password attribute
#access-key: ""
#secret-key: ""
store:
# support: file 、 db 、 redis
mode: db
session:
mode: db
lock:
mode: db
file:
dir: sessionStore
max-branch-session-size: 16384
max-global-session-size: 512
file-write-buffer-cache-size: 16384
session-reload-read-size: 100
flush-disk-mode: async
db:
datasource: druid
db-type: mysql
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://192.168.56.211:31306/seata?rewriteBatchedStatements=true
user: root
password: s00J8De852
min-conn: 5
max-conn: 100
global-table: global_table
branch-table: branch_table
lock-table: lock_table
distributed-lock-table: distributed_lock
query-limit: 100
max-wait: 5000
security:
secretKey: SeataSecretKey0c382ef121d778043159209298fd40bf3850a017
tokenValidityInMilliseconds: 1800000
ignore:
urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/api/v1/auth/login
5.直接启动
cd /root/seata
helm install seata ./seata-server
6.查看
7.访问nacos 看到已经被注册到nacos中。