Skip to content

Commit 5857fed

Browse files
committed
MINOR: enhance TCP CRD documentation for Secret usage
1 parent 8a74d80 commit 5857fed

File tree

1 file changed

+53
-6
lines changed

1 file changed

+53
-6
lines changed

documentation/custom-resource-tcp.md

+53-6
Original file line numberDiff line numberDiff line change
@@ -289,14 +289,61 @@ type: kubernetes.io/tls
289289
290290
Note that `ssl_certificate` can be:
291291
- the name of a Kubernetes Secret (**in the same namespace as the TCP CR**) containing the certificated and key
292-
- or a filename on the pod local filesystem
293-
- or a folder on the pod local filesystem
292+
- or a filename/folder on the pod local filesystem
294293

294+
More details below on both use cases
295+
296+
**1. Using a Kubernetes Secret name**
297+
298+
You can use a Secret name in `ssl_certificate`.
299+
Then the cert + key will be written in the Pod filesystem in the below paths and used from there:
300+
301+
| IC in cluster mode | IC out of cluster mode (external mode) |
302+
|------------------------|----------------------------------------|
303+
| /etc/haproxy/certs/tcp | \<config-dir\>/certs/tcp |
304+
305+
where `<config-dir>` is:
306+
- `/tmp/haproxy-ingress/etc` by default
307+
- `--config-dir` IC start argument if set.
308+
309+
310+
311+
312+
**2. Using a Folder/filename**
313+
314+
2-1. In cluster mode (IC Pod) : with a Kubernetes Secret
315+
316+
The recommanded way of using a folder (or a filename) is to mount a secret volume like below in the Ingress Controller Pod (it's possible to use `extraVolumes` and `extraVolumeMounts` in the Helm Charts):
317+
318+
```
319+
spec:
320+
template:
321+
spec:
322+
containers:
323+
...
324+
volumeMounts:
325+
- mountPath: "/var/certs"
326+
name: certs
327+
readOnly: true
328+
volumes:
329+
- name: certs
330+
secret:
331+
secretName: tcp-test-cert
332+
```
333+
334+
In the TCP CR, reference the volume mount path in `ssl_certificate`:
335+
```
336+
ssl_certificate: /var/certs
337+
```
338+
339+
**Note that storing the certificates in the Pod image and using for `ssl_certificate` a path to it, is NOT recommanded.**
340+
341+
342+
2-2. External mode
343+
344+
Using as `ssl_certificate` with a Kubernetes Secret name as presented above in 1- also works in external mode.
345+
It's also possibe to use a folder/filename in `external mode`, store the certificates there and reference this path as `ssl_certificate`.
295346

296-
It's for example possible to mount a SSL Secret in the Ingress Controller Pod on a volume and reference the volume mount path in `ssl_certificate`.
297-
Without change the Pod (/deployment manifest), you can use a Secret name in `ssl_certificate`.
298-
Then the cert + key will be written in the Pod filesystem in:
299-
- `/etc/haproxy/certs/tcp`
300347

301348

302349
### Generated Frontend and Backend configuration:

0 commit comments

Comments
 (0)