Skip to content

Commit b629bc8

Browse files
docs(eks): add documentation about EKS onboarding (#6853)
Co-authored-by: Pepe Fagoaga <[email protected]>
1 parent f628897 commit b629bc8

File tree

6 files changed

+39
-14
lines changed

6 files changed

+39
-14
lines changed

docs/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,7 @@ prowler kubernetes --kubeconfig-file path
548548

549549
For in-cluster execution, you can use the supplied yaml to run Prowler as a job within a new Prowler namespace:
550550
```console
551+
kubectl apply -f kubernetes/prowler-sa.yaml
551552
kubectl apply -f kubernetes/job.yaml
552553
kubectl apply -f kubernetes/prowler-role.yaml
553554
kubectl apply -f kubernetes/prowler-rolebinding.yaml

docs/tutorials/kubernetes/in-cluster.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ For in-cluster execution, you can use the supplied yaml files inside `/kubernete
99
They can be used to run Prowler as a job within a new Prowler namespace:
1010

1111
```console
12+
kubectl apply -f kubernetes/prowler-sa.yaml
1213
kubectl apply -f kubernetes/job.yaml
1314
kubectl apply -f kubernetes/prowler-role.yaml
1415
kubectl apply -f kubernetes/prowler-rolebinding.yaml

docs/tutorials/prowler-app.md

+26
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,32 @@ By default, the `kubeconfig` file is located at `~/.kube/config`.
9999

100100
<img src="../../img/kubernetes-credentials.png" alt="Kubernetes Credentials" width="700"/>
101101

102+
???+ note
103+
If you are adding an **Amazon EKS** cluster, follow these additional steps to ensure proper authentication:
104+
105+
1. Apply the necessary Kubernetes resources to your EKS cluster (you can find the files in the [`kubernetes` directory of the Prowler repository](https://github.com/prowler-cloud/prowler/tree/master/kubernetes)):
106+
```console
107+
kubectl apply -f kubernetes/prowler-sa.yaml
108+
kubectl apply -f kubernetes/prowler-role.yaml
109+
kubectl apply -f kubernetes/prowler-rolebinding.yaml
110+
```
111+
112+
2. Generate a long-lived token for authentication:
113+
```console
114+
kubectl create token prowler-sa -n prowler-ns --duration=0
115+
```
116+
- **Security Note:** The `--duration=0` option generates a non-expiring token, which may pose a security risk if not managed properly. Users should decide on an appropriate expiration time based on their security policies. If a limited-time token is preferred, set `--duration=<TIME>` (e.g., `--duration=24h`).
117+
- **Important:** If the token expires, Prowler Cloud will no longer be able to authenticate with the cluster. In this case, you will need to generate a new token and **remove and re-add the provider in Prowler Cloud** with the updated `kubeconfig`.
118+
119+
3. Update your `kubeconfig` to use the ServiceAccount token:
120+
```console
121+
kubectl config set-credentials prowler-sa --token=<SA_TOKEN>
122+
kubectl config set-context <CLUSTER_ARN> --user=prowler-sa
123+
```
124+
Replace <SA_TOKEN> with the generated token and <CLUSTER_ARN> with your EKS cluster ARN.
125+
126+
4. Now you can add the modified `kubeconfig` as the credentials of the AWS EKS Cluster in Prowler Cloud. Then simply test the connection.
127+
102128
---
103129

104130
## **Step 5: Test Connection**

kubernetes/job.yaml

-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
apiVersion: v1
2-
kind: Namespace
3-
metadata:
4-
name: prowler-ns
5-
6-
---
7-
apiVersion: v1
8-
kind: ServiceAccount
9-
metadata:
10-
name: prowler-sa
11-
namespace: prowler-ns
12-
13-
---
141
apiVersion: batch/v1
152
kind: Job
163
metadata:

kubernetes/prowler-sa.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: prowler-ns
5+
---
6+
apiVersion: v1
7+
kind: ServiceAccount
8+
metadata:
9+
name: prowler-sa
10+
namespace: prowler-ns

prowler/providers/kubernetes/services/rbac/rbac_service.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def _list_roles(self):
9595
"resources": rule.resources,
9696
"verbs": rule.verbs,
9797
}
98-
for rule in role.rules
98+
for rule in (role.rules or [])
9999
],
100100
}
101101
roles[role.metadata.uid] = Role(**formatted_role)

0 commit comments

Comments
 (0)