fix(k8s): enhance Kubernetes deployment (#3928)

Co-authored-by: Pepe Fagoaga <pepe@prowler.com>
This commit is contained in:
Sergio Garcia
2024-05-06 12:33:19 +02:00
committed by GitHub
parent 5c263db5d4
commit b19b80008d
3 changed files with 23 additions and 7 deletions

View File

@@ -323,16 +323,17 @@ For non in-cluster execution, you can provide the location of the KubeConfig fil
prowler kubernetes --kubeconfig-file path
```
For in-cluster execution, you can use the supplied yaml to run Prowler as a job:
For in-cluster execution, you can use the supplied yaml to run Prowler as a job within a new Prowler namespace:
```console
kubectl apply -f kubernetes/job.yaml
kubectl apply -f kubernetes/prowler-role.yaml
kubectl apply -f kubernetes/prowler-rolebinding.yaml
kubectl get pods --> prowler-XXXXX
kubectl logs prowler-XXXXX
kubectl get pods --namespace prowler-ns --> prowler-XXXXX
kubectl logs prowler-XXXXX --namespace prowler-ns
```
> By default, `prowler` will scan all namespaces in your active Kubernetes context, use flag `--context` to specify the context to be scanned and `--namespaces` to specify the namespaces to be scanned.
???+ note
By default, `prowler` will scan all namespaces in your active Kubernetes context. Use the flag `--context` to specify the context to be scanned and `--namespaces` to specify the namespaces to be scanned.
## Prowler v2 Documentation
For **Prowler v2 Documentation**, please check it out [here](https://github.com/prowler-cloud/prowler/blob/8818f47333a0c1c1a457453c87af0ea5b89a385f/README.md).

View File

@@ -1,13 +1,28 @@
apiVersion: v1
kind: Namespace
metadata:
name: prowler-ns
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: prowler-sa
namespace: prowler-ns
---
apiVersion: batch/v1
kind: Job
metadata:
name: prowler
namespace: prowler-ns
spec:
template:
metadata:
labels:
app: prowler
spec:
serviceAccountName: prowler-sa
containers:
- name: prowler
image: toniblyx/prowler:stable

View File

@@ -1,12 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: prowler-read-cluster-default-sa
name: prowler-read-cluster-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: prowler-read-cluster
subjects:
- kind: ServiceAccount
name: default
namespace: default
name: prowler-sa
namespace: prowler-ns