This section guides you through the basic steps to prepare and install Edge-LB for load balancing in a DC/OS™ cluster.
The steps to follow depend on the deployment scenario you want to implement. For example, if you are setting up a demonstration or small-scale cluster for testing, evaluation, or personal use, you can use an account that is a member of the superusers
group. In this case, you would use the default configuration settings to get started without creating a dedicated service account with specific permissions and a signed certificate.
For most production deployments, however, you should create a unique service account for installing and managing Edge-LB.
Before you begin
- You must have the DC/OS CLI and DC/OS Enterprise CLI installed.
- You must be logged in with an account that has
superuser
permission or the permissions listed in Installation permissions.
Preparing a service account
After you download the package artifacts and add the Edge-LB packages to the repository, you are ready to create and configure permissions for the service account you want to use to manage Edge-LB server and load balancer operations.
If you have successfully downloaded and added Edge-LB packages, you can continue to the instructions for creating a service account.
Editing settings before adding a service account
If you are not configuring a dedicated service account for managing Edge-LB pools, you can begin configuring Edge-LB settings by selecting the Edge-LB tiles in the Catalog, then clicking Review & Run.
-
Open the DC/OS web-based console, then click Catalog.
-
Type a string such as
edge
in the Search catalog field. -
Click edgelb to display the service summary.
-
Click Review & Run to edit the Edge-LB configuration settings by modifying the fields displayed, or by selecting JSON Editor to edit the JSON file directly.
-
Click Review & Run, then click Run Service to install the Edge-LB API server package with the configuration settings you specified.
-
Repeat steps 1 through 4 to configure Service settings for the Edge-LB pool.
-
Click Edgelbpool to specify the following required properties:
- count
- cpus
- mem
- disk
You can specify additional pool configuration properties as needed, then click Review & Run.
-
Click Run Service to install the Edge-LB pool service.
-
Click Services to verify the Edge-LB API and Edge-LB pool services are installed and running.
Create a service account
The Edge-LB API server must be associated with a service account so that it can launch Edge-LB pools on public and private nodes, based on user requests. Service accounts are used in conjunction with public/private key pairs, secrets, permissions, and authentication tokens to provide secure access for services running on DC/OS Enterprise clusters. For DC/OS Open Source clusters Service Accounts, provide the service with a login other than the user’s login.
DC/OS Enterprise Service Accounts
Creating a service account for DC/OS Enterprise involves the following steps:
- Create a public/private key pair
- Create a security principal for the service account
- Assign permissions to the service account principal
- Create and store a secret associated with the service account principal
The secret store is used by Edge-LB to retrieve and install SSL certificates on the Edge-LB pools. The SSL certificates enable transport layer security (TLS) for all HTTP-based traffic between client requests and service backends.
To create a service account for Edge-LB on DC/OS Enterprise
-
Open a shell terminal where you have access to the DC/OS Enterprise command-line interface (CLI).
-
Create a public/private key pair and save each value into a separate file:
This code sample creates the keys in the current directory. You must have write permission for the directory for the command to complete the operation successfully. Executing this command creates a 2048-bit RSA public/private key pair.
-
Create the security principal (
edge-lb-principal
) for the new service account containing the public key (edge-lb-public-key.pem
) created in the previous step: -
Verify the new service account:
The command displays output similar to the following:
-
Create a secret (
dcos-edgelb/edge-lb-secret
) for the service account principal (edge-lb-principal
) and private key (edge-lb-private-key.pem
):For more information about creating and storing secrets for services, see Configuring services and pods and Spaces.
-
List the secrets created:
The command displays output similar to the following:
-
Provision the Edge-LB service account with the required permissions by doing one of the following:
- Adding the service account principal to the
superusers
group. - Granting the permissions required to perform specific Edge-LB tasks.
Granting all permissions using the superusers group: Adding the service account principal (
edge-lb-principal
) to thesuperusers
group ensures that the account has sufficient permissions to perform all Edge-LB operations and upgrades. You can add the service account principal to thesuperusers
group by running a command similar to the following:After adding the service principal to the
supergroups
group, you can continue to Create a configuration file for service authentication and complete the installation.Granting specific permissions to the service account: If you follow the principle of least-privilege, you should not add the service account principal to the
superusers
group. Instead, you should limit the permissions granted to allow only management of DC/OS packages, Marathon tasks, and Edge-LB pool-related activity. You can grant specific permissions to the service account principal using commands similar to the following:These sample permissions also enable Edge-LB pool framework schedulers to register with Mesos master nodes and to launch load-balancer tasks. You must also grant the following permission for each Edge-LB pool created:
For more information about the permissions required to perform specific tasks, see the Edge-LB Permissions reference section.
- Adding the service account principal to the
After you have created a service account principal, stored the certificate as a secret, and assigned appropriate permissions, you are ready to create a configuration file and complete the installation.
DC/OS Open Source Service Accounts
Creating a service account for DC/OS Open Source involves the following steps:
- Create a public/private key pair
- Create a security principal for the service account
To create a service account for Edge-LB on DC/OS Open Source
-
Open a shell terminal where you have access to the DC/OS command-line interface (CLI), curl, openssl, and sed.
-
Create a public/private key pair and save each value into a separate file:
This code sample creates the keys in the current directory. You must have write permission for the directory for the command to complete the operation successfully. Executing this command creates a 2048-bit RSA public/private key pair.
-
Create the security principal (
edge-lb-principal
) for the new service account containing the public key (edge-lb-public-key.pem
) created in the previous step:
After you have created a service account principal, stored the certificate as a secret, and assigned appropriate permissions, you are ready to create a configuration file and complete the installation.
Create a configuration file for service authentication
After configuring service authentication, you must create a JSON options file with your credentials. This file is passed to DC/OS when you install Edge-LB.
-
For DC/OS Enterprise, open a new file for Edge-LB configuration options in a text editor.
For example:
Edit the file to specify the service account secret (
dcos-edgelb/edge-lb-secret
) that you created earlier.For DC/OS Open Source, specify the
dcosServiceAccountCreds
directly, newlines in theprivate-key.pem
must be embeded. The simplist way to do this is usingbash
redirection: -
Specify other configuration settings, as needed.
As an example of this effect, suppose you deployed a service with the JSON configuration file:
This command creates a service called
dcos-edgelb/api
from the Edge-LB service’s point of view. But that service name causes creation of the task name,dcos-edgelb/api/api
, which could become confusing! The string value, /api, is always (implicitly) appended to the name.As an alternative, after creating the edge-lb-options.json file and installing the edgelb/api service, execute the following command to rename the service so that you don’t have to track the name:
Examples of other configuration settings you can change include specifying the service path for the
apiserver
wheredcos-edgelb
corresponds to thepool.namespace
when configuring pools. Other common configuration settings specify the CPU, memory, disk, and log level (debug
,info
,warn
, orerror
) as shown here. -
Save the configuration file.
-
Add the configuration file to source control so that you can update configuration at a later time.
Install Edge-LB
After you have added the packages to the cluster catalog, created a secure service account, and configured settings for Edge-LB in a JSON file, you can install Edge-LB to begin creating and managing load balancing pools.
-
Install Edge-LB using the command:
This command prompts you to accept the terms and conditions to continue.
-
Enter yes to continue and review the output.
-
Run a command similar to the following to determine whether the Edge-LB service is ready for use:
When Edge-LB is ready, the ping command should return the
pong
response in standard output (stdout
).
-
For more information about configuring Edge-LB, see the Edge-LB pool configuration reference section.
-
For more information about the available Edge-LB commands, see the Edge-LB command-line reference section.