shiguanghuxian / etcd-manage

一个现代的etcd v3管理ui
http://140.143.234.132:10280/ui/#/key/kv
MIT License
244 stars 61 forks source link

无法启动docker 内的 etcd-manage #30

Closed yudar1024 closed 5 years ago

yudar1024 commented 5 years ago

docker 启动名命令如下 docker run -d --name etcdmanage -p 10280:10280 -v /etc/etcdmanage/cfg.toml:/app/config/cfg.toml -v /etc/kubernetes/pki/etcd/:/etc/etcd/etcdSSL/ -v /tmp/etcdmanagelog:/app/logs shiguanghuxian/etcd-manage

/etc/kubernetes/pki/etcd/ 目录是K8S 的etcd相关证书 启动后报错 [root@master1 ~]# docker logs d6bf58683228 2019/09/18 08:06:59 main.go:18: line 27: field corresponding toserver' is not defined in config.Config ` cfg.toml 的配置内容为

# debug模式
debug = true
# 日志文件路径
log_path = ""

# http 监听端口
[http]
# 监听地址
address = "0.0.0.0"
# 监听端口
port = 10280

# 使用 Let's Encrypt 证书 - tls_enable为true优先使用本地证书模式
tls_encrypt_enable = false
# 域名列表
tls_encrypt_domain_names = ["192.168.10.50"]

# 是否启用tls
tls_enable = true
# tls证书文件
[http.tls_config]
cert_file = "/etc/etcd/etcdSSL/healthcheck-client.crt"
key_file = "/etc/etcd/etcdSSL/healthcheck-client.key"

## 以下每一个server为一个etcd服务 ##
[[server]]

title = "kuberentes etcd cluster"

name = "kuberentes_etcd_cluster"

address = ["192.168.10.51:2379","192.168.10.50:2379","192.168.10.52:2379"]
# 查看的key前缀
key_prefix = "/"
# 简述信息
desc = "docker cluster"
# 可访问服务器角色列表 - 不写则为所有用户可访问
# roles = ["admin"]
# 是否启用tls连接
tls_enable = true
# tls证书配置
[server.tls_config]
cert_file = "/etc/etcd/etcdSSL/server.crt"
key_file = "/etc/etcd/etcdSSL/server.key"
ca_file = "/etc/etcd/etcdSSL/ca.crt"

## 以下为用户列表 ##
#[[user]]
#username = "admin"
#password = "123456"
#role = "admin"
shiguanghuxian commented 5 years ago

[server.tls_config]这个配置项才是连接etcd的证书配置 [http.tls_config]是配置ui管理工具用https访问时的证书,如果不公网访问,建议tls_enable = false 你再试试,不行和我说

yudar1024 commented 5 years ago

关闭tls 之后还是不行

# debug模式
debug = true
# 日志文件路径
log_path = ""

# http 监听端口
[http]
# 监听地址
address = "0.0.0.0"
# 监听端口
port = 10280

# 使用 Let's Encrypt 证书 - tls_enable为true优先使用本地证书模式
tls_encrypt_enable = false
# 域名列表
tls_encrypt_domain_names = ["192.168.10.50"]

# 是否启用tls
tls_enable = false
# tls证书文件
[http.tls_config]
cert_file = "/etc/etcd/etcdSSL/healthcheck-client.crt"
key_file = "/etc/etcd/etcdSSL/healthcheck-client.key"

## 以下每一个server为一个etcd服务 ##
[[server]]

title = "kuberentes etcd cluster"

name = "kuberentes_etcd_cluster"

address = ["192.168.10.51:2379","192.168.10.50:2379","192.168.10.52:2379"]
# 查看的key前缀
key_prefix = "/"
# 简述信息
desc = "docker cluster"
# 可访问服务器角色列表 - 不写则为所有用户可访问
# roles = ["admin"]
# 是否启用tls连接
tls_enable = true
# tls证书配置
[server.tls_config]
#cert_file = "/etc/etcd/etcdSSL/server.crt"
#key_file = "/etc/etcd/etcdSSL/server.key"
#ca_file = "/etc/etcd/etcdSSL/ca.crt"

## 以下为用户列表 ##
#[[user]]
#username = "admin"
#password = "123456"
#role = "admin"

还是报错,如下 server' is not defined in config.Config

shiguanghuxian commented 5 years ago

[server.tls_config]

cert_file = "/etc/etcd/etcdSSL/server.crt"

key_file = "/etc/etcd/etcdSSL/server.key"

ca_file = "/etc/etcd/etcdSSL/ca.crt"

这几个证书,配置对,我看还是我默认的配置

应该是类似这样的证书,看下/etc/etcd/etcdSSL下有没有对应证书文件 cert_file = "/etc/etcd/etcdSSL/healthcheck-client.crt" key_file = "/etc/etcd/etcdSSL/healthcheck-client.key"

shiguanghuxian commented 5 years ago

如果还不行,可加我微信,github用户名就是微信名