Red Hat Training

A Red Hat training course is available for OpenShift Container Platform

3.3.2. 获取路由器配置模板

HAProxy 模板文件非常大且复杂。对于某些更改,修改现有模板可能比编写完整的替换版本更简单。您可以通过在 master 上运行并引用路由器 pod,从正在运行的路由器获取 haproxy-config.template 文件:

# oc get po
NAME                       READY     STATUS    RESTARTS   AGE
router-2-40fc3             1/1       Running   0          11d
# oc exec router-2-40fc3 cat haproxy-config.template > haproxy-config.template
# oc exec router-2-40fc3 cat haproxy.config > haproxy.config

另外,您可以登录到运行路由器的节点:

# docker run --rm --interactive=true --tty --entrypoint=cat \
    registry.redhat.io/openshift3/ose-haproxy-router:v{product-version} haproxy-config.template

镜像名称来自容器镜像

将此内容保存到文件中,以用作自定义模板的基础。保存的 haproxy.config 显示实际运行的内容。