k8s 部署seata使用nacos作为配置中心

kind: Deployment
apiVersion: apps/v1
metadata:
  name: seata-v1
  namespace: health-examination-api
  labels:
    app: seata
    version: v1
  annotations:
    deployment.kubernetes.io/revision: '8'
    kubesphere.io/creator: project-admin
spec:
  replicas: 1
  selector:
    matchLabels:
      app: seata
      version: v1
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: seata
        version: v1
      annotations:
        kubesphere.io/restartedAt: '2021-06-08T10:00:01.089Z'
        logging.kubesphere.io/logsidecar-config: '{}'
    spec:
      volumes:
        - name: volume-syfmi2
          configMap:
            name: seata-server-config
            defaultMode: 420
      containers:
        - name: seata
          image: 'seataio/seata-server:1.3.0'
          ports:
            - name: http-8091
              containerPort: 8091
              protocol: TCP
          env:
            - name: SEATA_CONFIG_NAME
              value: 'file:/root/seata-config/registry'
          resources:
            limits:
              cpu: 500m
              memory: 500Mi
          volumeMounts:
            - name: volume-syfmi2
              readOnly: true
              mountPath: /root/seata-config
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: IfNotPresent
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      dnsPolicy: ClusterFirst
      serviceAccountName: default
      serviceAccount: default
      securityContext: {}
      affinity: {}
      schedulerName: default-scheduler
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 25%
      maxSurge: 25%
  revisionHistoryLimit: 10
  progressDeadlineSeconds: 600
---


kind: Service
apiVersion: v1
metadata:
  name: seata
  namespace: health-examination-api
  labels:
    app: seata
    version: v1
  annotations:
    kubesphere.io/creator: project-admin
    kubesphere.io/serviceType: statelessservice
spec:
  ports:
    - name: http-8091
      protocol: TCP
      port: 8091
      targetPort: 8091
  selector:
    app: seata
  clusterIP: 10.233.52.13
  type: ClusterIP
  sessionAffinity: None

---

kind: ConfigMap
apiVersion: v1
metadata:
  name: seata-server-config
  namespace: health-examination-api
  annotations:
    kubesphere.io/creator: project-admin
data:
  registry.conf: |
    registry {
        type = "nacos"
        nacos {
          group="SEATA_GROUP"
          namespace ="public"
          application = "seata-server"
          serverAddr = "nacos.health-examination-api.172.30.42.196.nip.io:30328"
        }
    }
    config {
      type = "nacos"
      nacos {
        serverAddr = "nacos.health-examination-api.172.30.42.196.nip.io:30328"
        group="SEATA_GROUP"
        namespace="public"
      }
    }

 

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 14
    评论
要在 Kubernetes 上部署 Seata,您可以按照以下步骤进行操作: 1. 创建 Seata 的配置文件: 在您的 Kubernetes 集群上创建一个 ConfigMap,将 Seata 的配置文件存储为一个或多个配置项。您可以根据需要创建一个名为 `seata-config` 的 ConfigMap,并将 Seata 的配置文件内容存储在其中。 2. 部署 Seata Server: 创建一个名为 `seata-server` 的 Deployment,指定 Seata Server 的容器镜像和其他相关配置。确保将 Seata Server 的端口暴露出来,以便其他服务可以连接到它。 3. 部署 Seata TC(Transaction Coordinator): 创建一个名为 `seata-tc` 的 Deployment,指定 Seata TC 的容器镜像和其他相关配置。确保将 Seata TC 的端口暴露出来,并将其连接到 Seata Server。 4. 配置微服务应用: 对于使用 Seata 进行分布式事务管理的微服务应用,需要添加 Seata 的依赖,并配置相关的数据源代理、事务管理器等。 5. 配置 Seata AT(Automatic Transaction)模式: 如果您使用的是 Seata AT 模式(自动事务),则需要在需要进行分布式事务管理的业务方法上添加 `@GlobalTransactional` 注解。 6. 部署其他微服务应用: 部署其他需要使用 Seata 进行分布式事务管理的微服务应用,并按照第 5 步的方式配置。 请注意,以上步骤仅提供了一个大致的部署流程,具体的实现细节可能会根据您的实际需求和环境而有所不同。建议您参考 Seata 官方文档以获取更详细的部署指南和配置说明。
评论 14
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值