Learn DC/OS with minidcos (4) – Use Marathon LB

In Part II, we deployed a service on the private node and in this part, let me talk about how to use marathon-lb to expose it onto the public node. For more details of Marathon and Marathon-LB, please check here.

Install Marathon-LB

With CLI, it’s easy to install marathon-lb, which is a package of DC/OS.

As you can see, the marathon-lb 1.15.0 is installed successfully. By default, it requires 2 CPU with 1GB memory. You can also adjust it from DC/OS GUI. In my testing, I need to remove “net.ipv4.tcp_max_orphans=60000” from Marathon-LB’s “Sysctl Params“. Otherwise, the service will be brought up.

You will find the marathon-lb service is up and it’s deployed on the public node.

Since marathon-lb uses HAProxy as its backend, we can access the HAProxy statistic panel through http://172.17.0.4:9090/haproxy?stats.

Expose the Nginx Service with Marathon-LB

To expose the nginx service, we can simply add following label “HAPROXY_GROUP: external” tn the configuration.

After relaunching the nginx service, you can access the nginx from public node (172.17.0.4) on service port 10000, which the real service runs on the private node (172.17.0.3).

Reference

Learn DC/OS with minidcos (3) – Install and Use DC/OS CLI

After Part I and Part II, you have a workable DC/OS cluster and a nginx service is running. In this chapter, let’s talk about how to use DC/OS CLI, which is a helpful tool.

Installation

The DC/OS CLI’s version need to be the same as the DC/OS cluster runs. With minidcos, I installed the 1.12.5 so CLI’s version needs to be 1.12 as well. Use the following commands to download the CLI binary.

Then setup it

The DC/OS page will be open and log into to get the token. When token is typed in, your CLI is already attached to the running cluster. It’s ready to use it.

Commands

DC/OS CLI provides a lot of useful commands. With it, you can do the same as the GUI does. Here are some examples.

For more details, please use argument “-h” to check.

Let’s use CLI to run a service. I extracted the Nginx service configuration into the JSON file and the id was changed to “/nginx-service2”.

Then use “dcos marathon app add” to create a new service “/nginx-service2

From GUI, you can see the similar status.

All right. Now you know how to install CLI and some basic commands to check the status of cluster/node/services.

References