-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
76ed0c1
commit 1f2c114
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# HAProxy | ||
|
||
# Use HAProxy with Docker | ||
|
||
## Using your own image | ||
|
||
Create a Dockerfile: | ||
``` | ||
FROM haproxy:2.3 | ||
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg | ||
``` | ||
Build the container: | ||
``` | ||
$ docker build -t my-haproxy . | ||
``` | ||
Test the configuration file | ||
``` | ||
$ docker run -it --rm --name haproxy-syntax-check my-haproxy haproxy -c -f /usr/local/etc/haproxy/haproxy.cfg | ||
``` | ||
Run the container: | ||
``` | ||
$ docker run -d --name my-running-haproxy --sysctl net.ipv4.ip_unprivileged_port_start=0 my-haproxy | ||
``` | ||
|
||
## Directly via bind mount | ||
|
||
``` | ||
$ docker run -d --name my-running-haproxy -v /path/to/etc/haproxy:/usr/local/etc/haproxy:ro --sysctl net.ipv4.ip_unprivileged_port_start=0 haproxy:2.3 | ||
``` | ||
Reloading config: | ||
``` | ||
$ docker kill -s HUP my-running-haproxy | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: nginx | ||
name: app1 | ||
namespace: default | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: nginx | ||
template: | ||
metadata: | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- image: nginx:alpine | ||
name: nginx |