add a example for haproxy_custom_configuration

fix some error
This commit is contained in:
caiyixiang 2017-04-06 09:31:38 +08:00
parent ed6987e716
commit 2c93ac868a
2 changed files with 66 additions and 0 deletions

View file

@ -0,0 +1,27 @@
# Customize the HAProxy configuration
This example use a [ConfigMap](https://kubernetes.io/docs/user-guide/configmap/) to customize the HAProxy configuration.
## Prerequisites
This document has the following prerequisites:
* Deploy a service named `ingress-default-backend` to be used as default backend service
* Create a [TLS secret](/examples/PREREQUISITES.md#tls-certificates) named `tls-secret` to be used as default TLS certificate
As mentioned in the deployment instructions, you MUST turn down any existing
ingress controllers before running HAProxy Ingress.
## Customize the HAProxy configuration
Using a [ConfigMap](https://kubernetes.io/docs/user-guide/configmap/) is possible to customize the HAProxy configuration
For example, if we want to change the syslog-endpoint we need to create a ConfigMap:
```
$ kubectl create configmap haproxy-conf --from-literal=syslog-endpoint=172.17.8.101
```
Please check the example `haproxy-custom-configuration.yaml`
If the Configmap it is updated, HAProxy will be reloaded with the new configuration.

View file

@ -0,0 +1,39 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
run: haproxy-ingress
name: haproxy-ingress
spec:
replicas: 1
selector:
matchLabels:
run: haproxy-ingress
template:
metadata:
labels:
run: haproxy-ingress
spec:
containers:
- name: haproxy-ingress
image: quay.io/jcmoraisjr/haproxy-ingress
args:
- --default-backend-service=default/ingress-default-backend
- --default-ssl-certificate=default/tls-secret
- --configmap=default/haproxy-conf
ports:
- name: http
containerPort: 80
- name: https
containerPort: 443
- name: stat
containerPort: 1936
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace