This tutorial explains how to deploy a NGINX web server and limit access to one team with role-based access control (RBAC).
You are the Docker EE system administrator at Acme Company and need to configure permissions to company resources. The best way to do this is to:
Add the organization, acme-datacenter
, and create three teams according to the
following structure:
acme-datacenter
├── dba
│ └── Alex Alutin
├── dev
│ └── Bett Bhatia
└── ops
└── Chad Chavez
Learn to create and configure users and teams.
In this section, we deploy NGINX with Kubernetes. See Swarm stack for the same exercise with Swarm.
Create a namespace to logically store the NGINX application:
apiVersion: v1
kind: Namespace
metadata:
name: nginx-namespace
You can use the built-in roles or define your own. For this exercise, create a simple role for the ops team:
Kube Deploy
.Learn to create and configure users and teams.
Grant the ops team (and only the ops team) access to nginx-namespace with the custom role, Kube Deploy.
acme-datacenter/ops + Kube Deploy + nginx-namespace
You’ve configured Docker EE. The ops
team can now deploy nginx
.
ops
team).apiVersion: apps/v1beta2 # Use apps/v1beta1 for versions < 1.8.0
kind: Deployment
metadata:
name: nginx-deployment
spec:
selector:
matchLabels:
app: nginx
replicas: 2
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
dba
(alex) can’t see nginx-namespace
.dev
(bett) can’t see nginx-namespace
.In this section, we deploy nginx
as a Swarm service. See Kubernetes Deployment
for the same exercise with Kubernetes.
Create a collection for NGINX resources, nested under the /Shared
collection:
/
├── System
└── Shared
└── nginx-collection
Tip: To drill into a collection, click View Children.
Learn to group and isolate cluster resources.
You can use the built-in roles or define your own. For this exercise, create a simple role for the ops team:
Swarm Deploy
.Learn to create and configure users and teams.
Grant the ops team (and only the ops team) access to nginx-collection
with
the built-in role, Swarm Deploy.
acme-datacenter/ops + Swarm Deploy + /Shared/nginx-collection
Learn to grant role-access to cluster resources.
You’ve configured Docker EE. The ops
team can now deploy an nginx
Swarm
service.
ops
team).nginx-service
/Shared
in the breadcrumbs.nginx-collection
.dba
(alex) cannot see nginx-collection
.dev
(bett) cannot see nginx-collection
.