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
+5 -4
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 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 ```console
kubectl apply -f kubernetes/job.yaml kubectl apply -f kubernetes/job.yaml
kubectl apply -f kubernetes/prowler-role.yaml kubectl apply -f kubernetes/prowler-role.yaml
kubectl apply -f kubernetes/prowler-rolebinding.yaml kubectl apply -f kubernetes/prowler-rolebinding.yaml
kubectl get pods --> prowler-XXXXX kubectl get pods --namespace prowler-ns --> prowler-XXXXX
kubectl logs 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 ## Prowler v2 Documentation
For **Prowler v2 Documentation**, please check it out [here](https://github.com/prowler-cloud/prowler/blob/8818f47333a0c1c1a457453c87af0ea5b89a385f/README.md). For **Prowler v2 Documentation**, please check it out [here](https://github.com/prowler-cloud/prowler/blob/8818f47333a0c1c1a457453c87af0ea5b89a385f/README.md).
+15
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 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
name: prowler name: prowler
namespace: prowler-ns
spec: spec:
template: template:
metadata: metadata:
labels: labels:
app: prowler app: prowler
spec: spec:
serviceAccountName: prowler-sa
containers: containers:
- name: prowler - name: prowler
image: toniblyx/prowler:stable image: toniblyx/prowler:stable
+3 -3
View File
@@ -1,12 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding kind: ClusterRoleBinding
metadata: metadata:
name: prowler-read-cluster-default-sa name: prowler-read-cluster-binding
roleRef: roleRef:
apiGroup: rbac.authorization.k8s.io apiGroup: rbac.authorization.k8s.io
kind: ClusterRole kind: ClusterRole
name: prowler-read-cluster name: prowler-read-cluster
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: default name: prowler-sa
namespace: default namespace: prowler-ns