Skip to content

Commit fc7dbb6

Browse files
committed
document Cluster Mode vs Namespace Mode RBAC
Adds explanation in the authorization.md document about the difference between Cluster Mode and Namespace Mode when starting an ACK controller including language that describes the various ClusterRole or Role permissions required for controllers started in either mode. Issue: #1173 Signed-off-by: Jay Pipes <jaypipes@gmail.com>
1 parent 973f9a2 commit fc7dbb6

File tree

3 files changed

+84
-9
lines changed

3 files changed

+84
-9
lines changed

docs/content/docs/user-docs/authorization.md

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,78 @@ Refer to the following diagram for more details on running a Kubernetes API serv
4040

4141
You will need to configure Kubernetes RBAC and AWS IAM permissions before using ACK service controllers.
4242

43-
## Kubernetes RBAC for ACK controller
43+
## Kubernetes RBAC
44+
45+
### Permissions required for the ACK service controller
46+
47+
ACK service controllers may be started in either *Cluster Mode* or *Namespace
48+
Mode*. Controllers started in Cluster Mode watch for new, updated and deleted
49+
custom resources (CRs) in all Kubernetes `Namespaces`. Conversely, controllers
50+
started in Namespace Mode only watch for CRs in a single Kubernetes `Namespace`
51+
identified by the `--watch-namespace` flag.
52+
53+
#### Namespace Mode
54+
55+
When a service controller is started in Namespace Mode, the `--watch-namespace`
56+
flag is supplied and the controller will *only* watch for custom resources
57+
(CRs) in that Kubernetes Namespace.
58+
59+
Controllers started in Namespace Mode require that the Kubernetes `Service
60+
Account` associated with the controller's `Deployment` have a `Role` with
61+
permissions to create, update/patch, delete, read, list and watch ACK custom
62+
resources matching the associated AWS service in the specific Kubernetes
63+
`Namespace` identified by the `--watch-namespace` flag.
64+
65+
{{% hint type="info" title="The `installScope: namespace` Helm Chart value" %}}
66+
If you are installing an ACK service controller via the associated Helm Chart,
67+
you can simplify a Namespace Mode installation by setting the `installScope`
68+
value to `namespace`. This will cause the Helm Chart to install a
69+
namespace-scoped `RoleBinding` with the necessary permissions the controller
70+
needs to create, update, read, list and watch the ACK custom resources managed
71+
by the controller.
72+
{{% /hint %}}
73+
74+
### Cluster Mode
75+
76+
When a service controller is started in Cluster Mode, the `--watch-namespace`
77+
flag is not supplied and the controller will watch for ACK custom resources
78+
(CRs) across *all* Kubernetes `Namespaces`.
79+
80+
Controllers started in Cluster Mode require that the Kubernetes `Service
81+
Account` associated with the controller's `Deployment` have a `ClusterRole`
82+
with permissions to create, update/patch, delete, read, list and watch ACK
83+
custom resources matching the associated AWS service in *all* Kubernetes
84+
`Namespaces`.
85+
86+
To support cross-account resource management, controllers started in Cluster
87+
Mode require that the Kubernetes `Service Account` associated with the
88+
controller's `Deployment` have a `ClusterRole` with permissions to read, list
89+
and watch *all* `Namespace` objects.
90+
91+
Additionally, the `ClusterRole` will need permissions to read `ConfigMap`
92+
resources in a specific Kubernetes `Namespace` identified by the environment
93+
variable `ACK_SYSTEM_NAMESPACE`, defaulting to `ack-system`.
94+
95+
{{% hint type="info" title="Cross-account resource management requires Cluster Mode" %}}
96+
If you plan to use an ACK service controller to manage resources across many
97+
AWS accounts (cross-account resource management, or CARM), you *must* start the
98+
controller in Cluster Mode.
99+
{{% /hint %}}
100+
101+
### Permission to read `Secret` objects
102+
103+
Some ACK service controllers will replace plain-text values for some resource
104+
fields with the value of Kubernetes `Secret` keys.
105+
106+
For controllers started in Namespace Mode, the `Role` must have permissions to
107+
read `Secret` objects in the Kubernetes `Namespace` identified by the
108+
`--watch-namespace` flag.
109+
110+
For controllers started in Cluster Mode, the `ClusterRole` must have
111+
permissions to read `Secret` resources in *any Kubernetes `Namespace` within
112+
which ACK custom resources may be launched*.
113+
114+
### Roles for reading and writing ACK custom resources
44115

45116
As part of installation, Kubernetes `Role` resources are automatically created. These roles contain permissions to modify the Kubernetes custom resources (CRs) that the ACK service controller is responsible for.
46117

docs/content/docs/user-docs/cross-account-resource-management.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "Manage Resources In Multiple AWS Accounts (CARM)"
2+
title: "Manage Resources In Multiple AWS Accounts"
33
description: "Managing resources in different AWS accounts"
44
lead: ""
55
draft: false
@@ -18,6 +18,10 @@ ACK service controllers can manage resources in different AWS accounts. To enabl
1818

1919
For detailed information about how ACK service controllers manage resources in multiple AWS accounts, please refer to the Cross-Account Resource Management (CARM) [design document](https://github.com/aws-controllers-k8s/community/blob/main/docs/design/proposals/carm/cross-account-resource-management.md).
2020

21+
{{% hint type="note" title="To use CARM, `--watch-namespace` must be empty" %}}
22+
ACK service controllers may be started in either Cluster Mode or Namespace Mode. When a service controller is started in Namespace Mode, the `--watch-namespace` flag is supplied and the controller will *only* watch for custom resources (CRs) in that Kubernetes Namespace. Because the cross-account resource management feature requires the controller to watch for custom resources on many Kubernetes Namespaces, this feature is incompatible with the Namespace Mode of running a controller and thus the `--watch-namespace` flag must not be set (or be set to an empty string).
23+
{{% /hint %}}
24+
2125
## Step 1: Configure your AWS accounts
2226

2327
AWS account administrators should create and configure IAM roles to allow ACK service controllers to assume roles in different AWS accounts.
@@ -41,7 +45,7 @@ apiVersion: v1
4145
kind: ConfigMap
4246
metadata:
4347
name: ack-role-account-map
44-
namespace: ack-system
48+
namespace: $ACK_SYSTEM_NAMESPACE
4549
data:
4650
"111111111111": arn:aws:iam::111111111111:role/s3FullAccess
4751
EOF

docs/content/docs/user-docs/install.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Helm charts for individual ACK service controllers are tagged with their release
3838
[ack-ecr-gallery]: https://gallery.ecr.aws/aws-controllers-k8s
3939
[s3-ecr-chart]: https://gallery.ecr.aws/aws-controllers-k8s/s3-chart
4040

41-
Before installing a Helm chart, you must first make the Helm chart available on the `Deployment` host. To do so, use the `helm pull` command and then extract the chart:
41+
Before installing a Helm chart, you must first make the Helm chart available on the dDeployment host. To do so, use the `helm pull` command and then extract the chart:
4242

4343
```bash
4444
export HELM_EXPERIMENTAL_OCI=1
@@ -63,16 +63,16 @@ different version, change the `RELEASE_VERSION` variable and execute the command
6363
Once the Helm chart is downloaded and exported, you can install a particular ACK service controller using the `helm install` command:
6464

6565
```bash
66-
export ACK_K8S_NAMESPACE=ack-system
66+
export ACK_SYSTEM_NAMESPACE=ack-system
6767
export AWS_REGION=us-west-2
6868

69-
helm install --create-namespace --namespace $ACK_K8S_NAMESPACE ack-$SERVICE-controller \
69+
helm install --create-namespace --namespace $ACK_SYSTEM_NAMESPACE ack-$SERVICE-controller \
7070
--set aws.region="$AWS_REGION" \
7171
$CHART_EXPORT_PATH/$SERVICE-chart
7272
```
7373

74-
{{% hint type="info" title="Specify your region" %}}
75-
The commands above set the service region of the S3 controller to `us-west-2`. Be sure to specify your region in the `AWS_REGION` variable.
74+
{{% hint type="info" title="Specify your target service region" %}}
75+
The commands above set the target service region of the S3 controller to `us-west-2`. Be sure to specify your target service region in the `AWS_REGION` variable. This will be the *default* AWS region in which resources will be created by the ACK service controller. Note that a single ACK service controller can manage the lifecycle of resources in multiple AWS regions: simply add the `services.k8s.aws/region=$REGION` annotation to your resource. Alternately, you can add the `services.k8s.aws/region=$REGION` annotation to a Kubernetes `Namespace` and any resource launched in that `Namespace` will be created in that region by default.
7676
{{% /hint %}}
7777

7878
The `helm install` command should return relevant installation information:
@@ -89,7 +89,7 @@ TEST SUITE: None
8989
To verify that the Helm chart was installed, use the `helm list` command:
9090

9191
```bash
92-
helm list --namespace $ACK_K8S_NAMESPACE -o yaml
92+
helm list --namespace $ACK_SYSTEM_NAMESPACE -o yaml
9393
```
9494

9595
The `helm list` command should return your newly-deployed Helm chart release information:

0 commit comments

Comments
 (0)