Mesos/Marathon - 不为 Marathon 应用程序提供角色保留资源

Mesos/Marathon - reserved resources for role are not offered for Marathon app

我通过将 --default_role="app-role" 参数设置为 ExecStart 来为特定角色 ("app-role") 分配从资源 (/etc/systemd/system/dcos-mesos-slave.service).接下来我重新启动了从代理:

sudo systemctl daemon-reload
sudo systemctl stop dcos-mesos-slave.service
sudo rm -f /var/lib/mesos/slave/meta/slaves/latest
sudo systemctl start dcos-mesos-slave.service 

并由以下人员验证:curl master.mesos/mesos/slaves

在那之后,我希望具有 acceptedResourceRoles 属性的 marathon 应用程序将仅接收这些特定的资源提议,但它并没有发生(应用程序仍处于等待状态)。

为什么马拉松没有收到?应该怎么做才能让它发挥作用?

{
  "id": "/basic-4",
  "cmd": "python3 -m http.server 8080",
  "cpus": 0.5,
  "mem": 32,
  "disk": 0,
  "instances": 1,
  "acceptedResourceRoles": [
    "app-role"
  ],
  "container": {
    "type": "DOCKER",
    "volumes": [],
    "docker": {
      "image": "python:3",
      "network": "BRIDGE",
      "portMappings": [
        {
          "containerPort": 8080,
          "hostPort": 0,
          "servicePort": 10000,
          "protocol": "tcp",
          "name": "my-vip",
          "labels": {
            "VIP_0": "/my-service:5555"
          }
        }
      ],
      "privileged": false,
      "parameters": [],
      "forcePullImage": false
    }
  },
  "portDefinitions": [
    {
      "port": 10000,
      "protocol": "tcp",
      "name": "default",
      "labels": {}
    }
  ]
}

这仅在马拉松开始时设置为 --mesos_role 时有效。 在问题的上下文中,这应该是:--mesos_role 'app-role'.

  1. If you set --mesos_role other, Marathon will register with Mesos for this role – it will receive offers for resources that are reserved for this role, in addition to unreserved resources.
  2. If you set default_accepted_resource_roles *, Marathon will apply this default to all AppDefinitions that do not explicitly define acceptedResourceRoles. Since your AppDefinition defines that option, the default will not be applied (both are equal anyways).
  3. If you set "acceptedResourceRoles": [""] in an AppDefinition (or the AppDefinition inherits a default of ""), Marathon will only consider unreserved resources for launching of this app.

更多:https://mesosphere.github.io/marathon/docs/recipes.html