[seata]为什么k8s启动的时候总是报端口被占用

2024-02-02 496 views
7

apiVersion: apps/v1 kind: Deployment metadata: name: seata-server namespace: basic labels: k8s-app: seata-server spec: replicas: 1 selector: matchLabels: k8s-app: seata-server template: metadata: labels: k8s-app: seata-server spec: imagePullSecrets:

  • name: registry-secret containers:
    • name: seata-server image: docker.io/seataio/seata-server:latest imagePullPolicy: IfNotPresent env:
      • name: SEATA_CONFIG_NAME value: file:/root/seata-config/registry ports:
      • name: http containerPort: 8091 protocol: TCP volumeMounts:
      • name: seata-config mountPath: /root/seata-config volumes:
    • name: seata-config configMap: name: seata-server-config

apiVersion: v1 kind: ConfigMap metadata: name: seata-server-config namespace: basic data: registry.conf: | registry { type = "nacos" nacos { application = "seata-server" serverAddr = namespace = username = "nacos" password =

    }
}
config {
  type = "nacos"
  nacos {
      serverAddr = 
      namespace = 
      username = "nacos"
      password = 
      dataId =  
      group = "DEFAULT_GROUP"
  }
}

这个是我的启动文件

回答

1

自行检查是否有定义了spring的server.port导致于netty端口冲突,之前有个用户就是全局配置了个env

0

我没有配env,啥也没指定都起不来

1

那你指定一个env SEATA_PORT=8092 试试

3

指定端口可以启动,如果不指定端口就会报错端口被占用,这个是不是bug呢

0

image

image

7

不是bug,你自己启动后进容器查看env,和启动参数的区别,没有这种问题,肯定是哪里指定了冲突的端口导致的