my test cluster need to call kong that listen on haproxy-protocal mode, So I need Haproxy before them.
fiile: haproxy.cfg
defaults
mode tcp
timeout connect 8s
timeout client 8h
timeout server 8h
frontend kong_https
mode tcp
bind 0.0.0.0:443
default_backend kong_https_backend
backend kong_https_backend
mode tcp
server kong1 10.16.51.21:443 check weight 1 send-proxy
server kong2 10.16.51.22:443 check weight 1 send-proxy
server kong3 10.16.51.23:443 check weight 1 send-proxy
file: haproxy-deploy.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: kong-haproxy
name: kong-haproxy
spec:
replicas: 2
selector:
matchLabels:
app: kong-haproxy
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
app: kong-haproxy
spec:
securityContext:
runAsUser: 0
containers:
- image: haproxy:2.7
volumeMounts:
- name: config-volume
mountPath: /usr/local/etc/haproxy/haproxy.cfg
subPath: haproxy.cfg
name: haproxy
resources:
requests:
cpu: 100m
memory: 100Mi
volumes:
- name: config-volume
configMap:
name: haproxy1
status: {}
Then run:
$ k create configmap haproxy1 --from-file=haproxy.cfg
$ k apply -f haproxy-deploy.yaml
$ k create service clusterip kong-haproxy --tcp=443:443
That’s all — hope it not permanent used.