Configuration
This section includes information on configurations.
ConfigMap
The HAProxy configuration is dynamically generated in ConfigMap with the name "marklogic-haproxy". A custom configuration can be used by creating a new ConfigMap and setting the existingConfigmap
parameter in the values.yaml
file to the name of the new ConfigMap.
Modify port configuration
By default, ports 8000, 8001, and 8002 are configured to handle HTTP traffic. The default ports can be modified in the values.yaml
file. For each entry, name
, type
, and port
must be specified. Type
can be one of these values:
HTTP - The backend is configured as an HTTP proxy that handles HTTPC traffic. It can also be configured to handle cookie-based session affinity and multi-statement transactions from the MarkLogic client.
TCP - The backend is configured as a TCP proxy that handles TCP traffic.
This is the default configuration:
haproxy: ports: - name: app-service type: HTTP port: 8000 targetPort: 8000 - name: admin type: HTTP port: 8001 targetPort: 8001 - name: manage type: HTTP port: 8002 targetPort: 8002
To add port 8010 for HTTP load balancing, add this configuration to the values.yaml
file:
- name: my-app-1 type: HTTP port: 8010 targetPort: 8010
To add port 5432 for TCP load balancing, add this configuration to the values.yaml
file:
- name: odbc type: TCP port: 5432 targetPort: 5432
Automatic reload configuration
When a change occurs in the current deployment (such as a change to the backend ports, or the number of running MarkLogic nodes), the HAProxy is restarted by default. During the restart process, the new configuration is loaded. However, the default behavior can be changed with this setting:
haproxy: restartWhenUpgrade: enabled: false
Note
if you update the number of MarkLogic nodes and restartWhenUpgrade.enabled
is set to false
, you must manually delete the HAProxy deployment to get the latest configuration.
Access HA Proxy
In Kubernetes, each pod is assigned its own IP address and namespace. Containers within a pod share the same namespace, IP, and MAC address as the pod. Therefore, nodes and pods can communicate with one another without using Network Address Translation (NAT). However, if a pod is restarted for any reason, it will be assigned a new IP address. Because a pod does not have a fixed IP or DNS, a service is used to connect to an application.
The HAProxy can be accessed from a service with the name of <RELEASE_NAME>-haproxy
. For example, if the release name is marklogic
, then the name of the service is marklogic-haproxy
.
External access
By default, HAProxy is configured to provide access within the Kubernetes cluster. However, HAProxy can provide external access by setting the service type in the values.yaml
file:
haproxy: service: type: LoadBalancer
Warning
By setting the haproxy service type to LoadBalancer
, the MarkLogic endpoint is exposed to the public internet. Because of this, networkPolicy
should be set to limit the sources that can visit MarkLogic.