Skip to content

Commit 97934ae

Browse files
committed
move Traefik doc
1 parent ebe2628 commit 97934ae

File tree

2 files changed

+58
-66
lines changed

2 files changed

+58
-66
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
id: traefik
3+
title: Traefix
4+
sidebar_position: 5
5+
---
6+
7+
import Tabs from '@theme/Tabs';
8+
import TabItem from '@theme/TabItem';
9+
import useBaseUrl from '@docusaurus/useBaseUrl';
10+
import RemediationSupportBadges from '@site/src/components/remediation-support-badge';
11+
12+
13+
<p align="center">
14+
<img src={useBaseUrl('/img/crowdsec_custom.svg')} alt="CrowdSec" title="CrowdSec" width="400" height="300" />
15+
</p>
16+
<p align="center">
17+
<img src="https://img.shields.io/badge/build-pass-green"></img>
18+
<img src="https://img.shields.io/badge/tests-pass-green"></img>
19+
</p>
20+
<p align="center">
21+
&#x1F4DA; <a href="#installation/">Documentation</a>
22+
&#x1F4A0; <a href="https://hub.crowdsec.net">Hub</a>
23+
&#128172; <a href="https://discourse.crowdsec.net">Discourse </a>
24+
</p>
25+
26+
<RemediationSupportBadges
27+
Prometheus
28+
/>
29+
30+
### Traefik on kubernetes
31+
32+
Traefik expects a resource of "Middleware" type named "bouncer", which we will create now.
33+
34+
Here is bouncer-middleware.yaml:
35+
36+
```yaml
37+
apiVersion: traefik.io/v1alpha1
38+
kind: Middleware
39+
metadata:
40+
name: bouncer
41+
namespace: traefik
42+
spec:
43+
plugin:
44+
bouncer:
45+
enabled: true
46+
crowdsecMode: stream
47+
crowdsecLapiScheme: https
48+
crowdsecLapiHost: crowdsec-service.crowdsec:8080
49+
crowdsecLapiKey: mysecretkey12345
50+
```
51+
52+
You can see all the configuration options in the [bouncer documentation](https://plugins.traefik.io/plugins/6335346ca4caa9ddeffda116/crowdsec-bouncer-traefik-plugin).
53+
54+
Now, you can install the remediation component:
55+
56+
```bash
57+
kubectl apply -f bouncer-middleware.yaml
58+
```

crowdsec-docs/unversioned/getting_started/installation/kubernetes.mdx

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -122,73 +122,7 @@ lapi:
122122
Then, you can install the remediation component with the following command:
123123
124124
125-
#### Traefik
126125
127-
Traefik expects a resource of "Middleware" type named "bouncer", which we will create now.
128-
129-
Here is bouncer-middleware.yaml:
130-
131-
```yaml
132-
apiVersion: traefik.io/v1alpha1
133-
kind: Middleware
134-
metadata:
135-
name: bouncer
136-
namespace: traefik
137-
spec:
138-
plugin:
139-
bouncer:
140-
enabled: true
141-
crowdsecMode: stream
142-
crowdsecLapiScheme: https
143-
crowdsecLapiHost: crowdsec-service.crowdsec:8080
144-
crowdsecLapiKey: mysecretkey12345
145-
```
146-
147-
You can see all the configuration options in the [bouncer documentation](https://plugins.traefik.io/plugins/6335346ca4caa9ddeffda116/crowdsec-bouncer-traefik-plugin).
148-
149-
Now, you can install the remediation component:
150-
151-
```bash
152-
kubectl apply -f bouncer-middleware.yaml
153-
```
154-
155-
#### Nginx
156-
157-
:::info
158-
We supposed that you have already installed the Nginx ingress controller using this [helm chart](https://artifacthub.io/packages/helm/ingress-nginx/ingress-nginx).
159-
:::
160-
161-
We need to patch ingress-nginx helm chart to add and enable [the crowdsec lua plugin](https://github.com/crowdsecurity/cs-openresty-bouncer).
162-
You can put this configuration example in a file `crowdsec-ingress-nginx.yaml`:
163-
164-
```yaml
165-
controller:
166-
extraVolumes:
167-
- name: crowdsec-bouncer-plugin
168-
emptyDir: {}
169-
extraInitContainers:
170-
- name: init-clone-crowdsec-bouncer
171-
image: crowdsecurity/lua-bouncer-plugin
172-
imagePullPolicy: IfNotPresent
173-
env:
174-
- name: API_URL
175-
value: "http://crowdsec-service.crowdsec.svc.cluster.local:8080"
176-
- name: API_KEY
177-
value: "mysecretkey12345"
178-
- name: BOUNCER_CONFIG
179-
value: "/crowdsec/crowdsec-bouncer.conf"
180-
command: ['sh', '-c', "sh /docker_start.sh; mkdir -p /lua_plugins/crowdsec/; cp -R /crowdsec/* /lua_plugins/crowdsec/"]
181-
volumeMounts:
182-
- name: crowdsec-bouncer-plugin
183-
mountPath: /lua_plugins
184-
extraVolumeMounts:
185-
- name: crowdsec-bouncer-plugin
186-
mountPath: /etc/nginx/lua/plugins/crowdsec
187-
subPath: crowdsec
188-
config:
189-
plugins: "crowdsec"
190-
lua-shared-dicts: "crowdsec_cache: 50m"
191-
```
192126
193127
Once we have this patch we can upgrade the ingress-nginx chart
194128

0 commit comments

Comments
 (0)