我尝试将蚀刻作为一个运行在带有波德曼的容器中的systemd服务来启动。
启动后,我从systemd获得这个错误日志:
systemd[1]: etcd.service: Got notification message from PID 4696, but reception only permitted for main PID 4868但是etcd似乎能够开始尝试通知容器守护进程:
21T15:31:08.817Z","caller":"etcdserver/server.go:2500","msg":"cluster version>
Aug 21 15:31:08 ip-10-0-0-71 podman[4696]: {"level":"info","ts":"2021-08-21T15:31:08.817Z","caller":"etcdmain/main.go:47","msg":"notifying init daemon>
Aug 21 15:31:08 ip-10-0-0-71 podman[4696]: {"level":"info","ts":"2021-08-21T15:31:08.818Z","caller":"etcdmain/main.go:53","msg":"successfully notified>但是systemd似乎没有意识到这一点,因此终止了etcd服务:
Aug 21 15:32:34 ip-10-0-0-71 systemd[1]: etcd.service: start operation timed out. Terminating.
Aug 21 15:32:35 ip-10-0-0-71 podman[4696]: {"level":"info","ts":"2021-08-21T15:32:35.000Z","caller":"osutil/interrupt_unix.go:64","msg":"received sign>
Aug 21 15:32:35 ip-10-0-0-71 podman[4696]: {"level":"info","ts":"2021-08-21T15:32:35.000Z","caller":"embed/etcd.go:367","msg":"closing etcd server","n>这是systemd服务状态:
$ sudo systemctl status etcd.service
● etcd.service - etcd
Loaded: loaded (/etc/systemd/system/etcd.service; enabled; vendor preset: enabled)
Active: failed (Result: timeout) since Sat 2021-08-21 15:32:35 UTC; 8min ago
Process: 4868 ExecStart=/usr/bin/podman run -p 2380:2380 -p 2379:2379 --volume=/var/lib/etcd:/etcd-data:z --name etcd 842445240665.dkr.ecr.eu-nort>
Main PID: 4868 (code=exited, status=0/SUCCESS)
CPU: 3.729s这是我的systemd单元服务文件,用于从podman开始的etcd:
cat <<EOF | sudo tee /etc/systemd/system/etcd.service
[Unit]
Description=etcd
After=podman_ecr_login.service mk_etcd_data_dir.service
[Service]
Type=notify
ExecStart=/usr/bin/podman run -p 2380:2380 -p 2379:2379 --volume=/var/lib/etcd:/etcd-data:z \
--name etcd <my-aws-account>.dkr.ecr.eu-north-1.amazonaws.com/etcd:v3.5.0 \
/usr/local/bin/etcd --data-dir=/etcd-data \
--name etcd0 \
--advertise-client-urls http://127.0.0.1:2379 \
--listen-client-urls http://0.0.0.0:2379 \
--initial-advertise-peer-urls http://127.0.0.1:2380 \
--listen-peer-urls http://0.0.0.0:2380 \
--initial-cluster etcd0=http://127.0.0.1:2380
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable etcd
sudo systemctl start etcd我怀疑这可能与Type=notify有关,也可能与我使用podman或etcd的方式有关。我以与etcd文档中描述的类似的方式启动etcd:在容器中运行etcd集群-运行单个节点etcd。我用Podman 3.0.1在Debian 11上运行这个程序。
对于如何开始使用podman作为系统服务,有什么建议吗?
发布于 2021-08-21 16:04:14
根据这个发行评论,这些服务应该以Type=simple的形式运行,因为它们不向systemd发出信号。这个按下 to podman将其设置为Type=exec,这似乎也很好。
在我的服务单元文件中更改为Type=exec之后,它现在可以工作了:
$ sudo systemctl status etcd.service
● etcd.service - etcd
Loaded: loaded (/etc/systemd/system/etcd.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2021-08-21 15:59:23 UTC; 1min 28s ago
Main PID: 4662 (podman)
Tasks: 11 (limit: 442)
Memory: 137.9M
CPU: 3.576s
CGroup: /system.slice/etcd.service
├─4662 /usr/bin/podman run -p 2380:2380 -p 2379:2379 --volume=/var/lib/etcd:/etcd-data:z --name etcd <my-aws-account>.dkr.ecr.eu-north-1.amaz>
└─4846 /usr/bin/conmon --api-version 1 -c 616b317dc255ca86b308857dc6a180510fc166975a8a28437f3434111f03e7ad -u 616b317dc255ca86b308857dc6a>https://serverfault.com/questions/1075280
复制相似问题