我最近在haproxy网站上写了一篇文章(2021年8月9日),据说是关于如何在码头上运行haproxy。
https://www.haproxy.com/blog/how-to-run-haproxy-with-docker/
我遵循了这个指南,我有下面的haproxy.cfg
global
stats socket /var/run/api.sock user haproxy group haproxy mode 660 level admin expose-fd listeners
log stdout format raw local0 info
defaults
mode http
timeout client 10s
timeout connect 5s
timeout server 10s
timeout http-request 10s
log global
frontend stats
bind *:8404
stats enable
stats uri /
stats refresh 10s
frontend myfrontend
bind :80
default_backend webservers
backend webservers
server s1 jmalloc-1:8080 check
server s2 jmalloc-2:8080 check
server s3 jmalloc-3:8080 check
但我会发现这些错误
haproxy | [NOTICE] (1) : haproxy version is 2.4.17-9f97155
haproxy | [ALERT] (1) : parsing [/usr/local/etc/haproxy/haproxy.cfg:26]: Missing LF on last line, file might have been truncated at position 33.
haproxy | [ALERT] (1) : Error(s) found in configuration file : /usr/local/etc/haproxy/haproxy.cfg
haproxy | [ALERT] (1) : Fatal errors found in configuration.
haproxy | [NOTICE] (1) : haproxy version is 2.4.17-9f97155
haproxy | [ALERT] (1) : parsing [/usr/local/etc/haproxy/haproxy.cfg:26]: Missing LF on last line, file might have been truncated at position 33.
我在这里错过了什么?
发布于 2022-07-27 14:47:15
正如Imsec所提到的,这是Unable to start haproxy 2.4 - Missing LF on last line?的一个副本。
但是,在使用Kubernetes的情况下,解决问题的是删除chomp指示符,以便在文件创建时保留新行。
也就是说-不工作
data:
haproxy.cfg: |-
global
{{- range .Values.haproxy_conf.globals }}
{{ . }}
{{- end }}
...
工作:
haproxy.cfg: |
global
{{- range .Values.haproxy_conf.globals }}
{{ . }}
{{- end }}
...
如果您没有使用配置映射并将其复制到dockerfile中,只需在eof中添加一条新行或通过entrypoint或run命令将其添加进来就足够了。
https://stackoverflow.com/questions/72697467
复制相似问题