With Docker EE Advanced, you can enable physical isolation of resources
by organizing nodes into collections and granting Scheduler
access for
different users. To control access to nodes, move them to dedicated collections
where you can grant access to specific users, teams, and organizations.
In this example, a team gets access to a node collection and a resource collection, and UCP access control ensures that the team members can’t view or use swarm resources that aren’t in their collection.
You need a Docker EE Advanced license and at least two worker nodes to complete this example.
Ops
team and assign a user to it./Prod
collection for the team’s node./Prod
collection.Ops
teams access to its collection.In the web UI, navigate to the Organizations & Teams page to create a team named “Ops” in your organization. Add a user who isn’t a UCP administrator to the team. Learn to create and manage teams.
In this example, the Ops team uses an assigned group of nodes, which it accesses through a collection. Also, the team has a separate collection for its resources.
Create two collections: one for the team’s worker nodes and another for the team’s resources.
You’ve created two new collections. The /Prod
collection is for the worker
nodes, and the /Prod/Webserver
sub-collection is for access control to
an application that you’ll deploy on the corresponding worker nodes.
By default, worker nodes are located in the /Shared
collection.
Worker nodes that are running DTR are assigned to the /System
collection.
To control access to the team’s nodes, move them to a dedicated collection.
Move a worker node by changing the value of its access label key,
com.docker.ucp.access.label
, to a different collection.
/System
collection, click another worker node,
because you can’t move nodes that are in the /System
collection. By
default, worker nodes are assigned to the /Shared
collection.com.docker.ucp.access.label
and change
its value from /Shared
to /Prod
./Prod
collection.Docker EE Advanced required
If you don’t have a Docker EE Advanced license, you’ll get the following error message when you try to change the access label: Nodes must be in either the shared or system collection without an advanced license. Get a Docker EE Advanced license.
You need two grants to control access to nodes and container resources:
Ops
team the Restricted Control
role for the /Prod/Webserver
resources.Ops
team the Scheduler
role against the nodes in the /Prod
collection.Create two grants for team access to the two collections:
/Prod/Webserver
collection.The same steps apply for the nodes in the /Prod
collection.
Scheduler
access to the nodes in the
/Prod
collection.The cluster is set up for node isolation. Users with access to nodes in the
/Prod
collection can deploy Swarm services
and Kubernetes apps, and their workloads
won’t be scheduled on nodes that aren’t in the collection.
When a user deploys a Swarm service, UCP assigns its resources to the user’s default collection.
From the target collection of a resource, UCP walks up the ancestor collections
until it finds the highest ancestor that the user has Scheduler
access to.
Tasks are scheduled on any nodes in the tree below this ancestor. In this example,
UCP assigns the user’s service to the /Prod/Webserver
collection and schedules
tasks on nodes in the /Prod
collection.
As a user on the Ops
team, set your default collection to /Prod/Webserver
.
Ops
team.Deploy a service automatically to worker nodes in the /Prod
collection.
All resources are deployed under the user’s default collection,
/Prod/Webserver
, and the containers are scheduled only on the nodes under
/Prod
.
Click the NGINX container, and in the details pane, confirm that its Collection is /Prod/Webserver.
Click the node, and in the details pane, confirm that its Collection is /Prod.
Another approach is to use a grant instead of changing the user’s default
collection. An administrator can create a grant for a role that has the
Service Create
permission against the /Prod/Webserver
collection or a child
collection. In this case, the user sets the value of the service’s access label,
com.docker.ucp.access.label
, to the new collection or one of its children
that has a Service Create
grant for the user.
Starting in Docker Enterprise Edition 2.0, you can deploy a Kubernetes workload to worker nodes, based on a Kubernetes namespace.
To deploy Kubernetes workloads, an administrator must convert a worker node to
use the Kubernetes orchestrator.
Learn how to set the orchestrator type
for your nodes in the /Prod
collection.
An administrator must create a Kubernetes namespace to enable node isolation for Kubernetes workloads.
In the Object YAML editor, paste the following YAML.
apiVersion: v1
kind: Namespace
metadata:
Name: ops-nodes
ops-nodes
namespace.Create a grant to the ops-nodes
namespace for the Ops
team by following the
same steps that you used to grant access to the /Prod
collection, only this
time, on the Create Grant page, pick Namespaces, instead of
Collections.
Select the ops-nodes namespace, and create a Full Control
grant for the
Ops
team.
The last step is to link the Kubernetes namespace the /Prod
collection.
Click the More options icon and select Link nodes in collection.
Click Confirm to link the namespace to the collection.
Ops
team.Click Create, and in the Object YAML editor, paste the following YAML definition for an NGINX server.
apiVersion: v1
kind: ReplicationController
metadata:
name: nginx
spec:
replicas: 1
selector:
app: nginx
template:
metadata:
name: nginx
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
In the left pane, click Pods and confirm that the workload is running
on pods in the ops-nodes
namespace.