原创

k8s 安装笔记 - 部署seata服务

温馨提示:
本文最后更新于 2023年07月10日 ,已超过 649 天没有更新。若文章内的图片失效(无法正常加载),请留言反馈或直接联系我

官方的配置文件(仅仅参考不能使用,官方没有更新文档)

使用 Kubernetes 部署 Seata Server

首先我们下载当前最新的版本 1.6.1 版本

配置 seata-configmaps.yaml 文件

apiVersion: v1
kind: ConfigMap
metadata:
  name: seata-server-config
  namespace: devops
data:
  application.yml: |
    spring:
      application:
        name: seata-server
    logging:
      config: classpath:logback-spring.xml
      file:
        path: ${user.home}/logs/seata
    console:
      user:
        username: seata
        password: seata
    seata:
      config:
        type: nacos
        nacos:
          server-addr: nacos-svc:8848
          namespace: 76e0c819-7ba7-4d99-941d-07cb1f32525c
          group: SEATA_GROUP
          username: nacos
          password: Exiaokang2021
          #context-path:
          ##if use MSE Nacos with auth, mutex with username/password attribute
          #access-key:
          #secret-key:
          data-id: seata.properties # 需要配置可以在nacos里面进行修改和新增
      registry:
        type: nacos
        nacos:
          application: seata-server
          server-addr: nacos-svc:8848
          group: SEATA_GROUP
          namespace: 76e0c819-7ba7-4d99-941d-07cb1f32525c
          #cluster: wmCluster
          username: nacos
          password: Exiaokang2021
          #context-path:
          ##if use MSE Nacos with auth, mutex with username/password attribute
          #access-key:
          #secret-key:
      store:
        mode: db
        db:
          datasource: hikari
          db-type: mysql
          driver-class-name: com.mysql.jdbc.Driver
          url: jdbc:mysql://mysql-svc:3306/cloud_seata?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true
          user: cloud_seata
          password: cloud_seata123
          min-conn: 10
          max-conn: 100
          global-table: global_table
          branch-table: branch_table
          lock-table: lock_table
          distributed-lock-table: distributed_lock
          query-limit: 1000
          max-wait: 5000
      server:
          service-port: 30091
      security:
        secretKey: SeataSecretKey0c382ef121d778043159209298fd40bf3850a017
        tokenValidityInMilliseconds: 1800000
        ignore:
          urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/api/v1/auth/login

配置 seata-deploy.yaml文件

apiVersion: apps/v1
kind: Deployment
metadata:
  name: seata-server
  namespace: devops
  labels:
    k8s-app: seata-server
spec:
  replicas: 1
  selector:
    matchLabels:
      k8s-app: seata-server
  template:
    metadata:
      labels:
        k8s-app: seata-server
    spec:
      containers:
        - name: seata-server
          image: docker.io/seataio/seata-server:1.6.1 # 不要使用latest 官方没有说明文档,配置部分版本不兼容
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 8091
              protocol: TCP
          volumeMounts:
            - name: seata-config
              mountPath: /seata-server/config # 最值得关注的配置,全网没有一个配置对的。在当前的版本。
      volumes:
        - name: seata-config
          configMap:
            name: seata-server-config

执行部署

kubectl apply -f seata-configmaps.yaml # 配置文件
kubectl apply -f seata-deploy.yaml     # 部署文建
正文到此结束
本文目录