没有合适的节点 - 无法将约束服务与 docker swarm 节点匹配

问题描述 投票:0回答:1

我执行

sudo docker node ls

这是我的输出

ID                            HOSTNAME          STATUS    AVAILABILITY   MANAGER STATUS   ENGINE VERSION
smlsbj3r6qjq7s22cl9cgi1f1 *   ip-172-30-0-94    Ready     Active         Leader           20.10.2
b5e3w8nvrw3kw8q3sg1188439     ip-172-30-0-107   Ready     Active                          20.10.2
phjkfj09ydvgzztaib2zxcfv9     ip-172-30-0-131   Ready     Active                          20.10.2
m73z9ikte16klds06upruifji     ip-172-30-0-193   Ready     Active                          20.10.2

到目前为止,我知道我有一名经理和三名工人。因此,如果我有一个服务具有与工作节点的 node.role 属性匹配的约束,那么 docker swarm 将选择其中一些来执行与服务本身相关的容器。 我目前的服务信息是这样的:

ID:     5p4hpxmvru9kbwz9y5oymoeq0
Name:       elasbit_relay1
Service Mode:   Replicated
 Replicas:  1
Placement:
 Constraints:   [node.role!=manager]
UpdateConfig:
 Parallelism:   1
 On failure:    pause
 Monitoring Period: 5s
 Max failure ratio: 0
 Update order:      stop-first
RollbackConfig:
 Parallelism:   1
 On failure:    pause
 Monitoring Period: 5s
 Max failure ratio: 0
 Rollback order:    stop-first
ContainerSpec:
 Image:     inputoutput/cardano-node:latest@sha256:02779484dc23731cdbea6388920acc6ddd8e40c03285bc4f9c7572a91fe2ee08
 Args:      run --topology /configuration/testnet-topology.json --database-path /db --socket-path /db/node.socket --host-addr 0.0.0.0 --port 3001 --config /configuration/testnet-config.json 
 Init:      false
Mounts:
 Target:    /configuration
  Source:   /home/ubuntu/cardano-docker-run/testnet
  ReadOnly: true
  Type:     bind
 Target:    /db
  Source:   db
  ReadOnly: false
  Type:     volume
Resources:
Endpoint Mode:  vip
Ports:
 PublishedPort = 12798
  Protocol = tcp
  TargetPort = 12798
  PublishMode = ingress 

关键部分是

[node.role!=manager]
。它给了我
no suitable node (unsupported platform on 3 nodes; scheduling constraints …

我尝试了很多方法:

  • 使用 docker-compose 格式 (yml) 和约束列表:
deploy:
  replicas: 1
  placement:
    constraints: [node.role==worker]
  restart_policy:
    condition: on-failure
  • 对节点使用标签。

所有这些我都失败了。有趣的是,如果我对节点管理器进行一些限制,它就会起作用!我有什么错字吗?嗯,我没看到。 我使用 Docker 版本 20.10.2,构建 20.10.2-0ubuntu1~18.04.2。

docker yaml docker-swarm
1个回答
0
投票

你可以尝试使用[node.hostname== 你的worker],我遇到了同样的问题,这让我陷入了错误。

希望这有帮助:)!!!

© www.soinside.com 2019 - 2024. All rights reserved.