2

I have deployed a hello world application in Azure using DCOS and Marathon Framework.I am trying to access that using fqn: portnumber at which the application is hosted. I am unable to open the application

Following is the json I have used

{
  "id": "/dockercloud-hello-world",
  "cmd": null,
  "cpus": 0.1,
  "mem": 128,
  "disk": 0,
  "instances": 2,
  "acceptedResourceRoles": [
    "*"
  ],
  "container": {
    "type": "DOCKER",
    "volumes": [],
    "docker": {
      "image": "dockercloud/hello-world",
      "network": "BRIDGE",
      "portMappings": [
        {
          "containerPort": 80,
          "hostPort": 0,
          "servicePort": 10000,
          "protocol": "tcp",
          "labels": {}
        }
      ],
      "privileged": false,
      "parameters": [],
      "forcePullImage": true
    }
  },
  "healthChecks": [
    {
      "gracePeriodSeconds": 10,
      "intervalSeconds": 2,
      "timeoutSeconds": 10,
      "maxConsecutiveFailures": 10,
      "portIndex": 0,
      "path": "/",
      "protocol": "HTTP",
      "ignoreHttp1xx": false
    }
  ],
  "portDefinitions": [
    {
      "port": 10000,
      "protocol": "tcp",
      "name": "default",
      "labels": {}
    }
  ]
}

I have added NSG Inbound rule for master nsg resource I have added NAT rule for master lb resource allowing the port as custom

Shui shengbao
  • 18,746
  • 3
  • 27
  • 45
Sumanth Itha
  • 89
  • 1
  • 9

2 Answers2

1

In your example, host port is 0, Azure will listen your service on a random port. You need open the port on NSG and lb.

I suggest you could specify the port, you could check the following example:

{
  "id": "/dockercloud-hello-world",
  "cmd": null,
  "cpus": 0.1,
  "mem": 32,
  "disk": 0,
  "instances": 1,
  "acceptedResourceRoles": [
    "slave_public"
  ],
  "container": {
    "type": "DOCKER",
    "volumes": [],
    "docker": {
      "image": "dockercloud/hello-world",
      "network": "BRIDGE",
      "portMappings": [
        {
          "containerPort": 80,
          "hostPort": 80,
          "protocol": "tcp",
          "labels": {},
          "name": "test80"
        }
      ],
      "privileged": false,
      "parameters": [],
      "forcePullImage": true
    }
  },
  "healthChecks": [
    {
      "gracePeriodSeconds": 10,
      "intervalSeconds": 2,
      "timeoutSeconds": 10,
      "maxConsecutiveFailures": 10,
      "portIndex": 0,
      "path": "/",
      "protocol": "MESOS_HTTP",
      "ignoreHttp1xx": false
    }
  ],
  "requirePorts": true
}

Note: You should set acceptedResourceRoles to slave_public. More information about this please check this link.

Shui shengbao
  • 18,746
  • 3
  • 27
  • 45
1

Along with the above-mentioned JSON I need to use the agent URL to access the application. I was missing on that

Sumanth Itha
  • 89
  • 1
  • 9