0
votes

I have assigned slave resources to the particular role ("app-role") by set --default_role="app-role" parameter to ExecStart for slave service ( /etc/systemd/system/dcos-mesos-slave.service). Next I have restarted slave agent:

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 

and verified by: curl master.mesos/mesos/slaves.

After that I expect marathon app with acceptedResourceRoles attribute will receive only these particular resource offers, but it does not happen (the app is still in waiting state).

Why does marathon didn't receive it? How should this be done to make it work?

{
  "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": {}
    }
  ]
}
1

1 Answers

0
votes

This works only if marathon is started with --mesos_role set. In the context of the question this should be: --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.

More: https://mesosphere.github.io/marathon/docs/recipes.html