Native Kubernetes
- Last Updated: September 4, 2026
- 2 minute read
- MarkLogic Server
- Documentation
In a native Kubernetes environment, you can access MarkLogic by using the ClusterIP service, DNS record, or port-forward command.
Use the ClusterIP service
You can use the ClusterIP service to access MarkLogic within a Kubernetes cluster.
Warning:
The Kubernetes service does not support HTTP-level load balancing and cookie-based session affinity. To support cookie-based session affinity, use HAProxy as the load balancer.
To use the ClusterIP service:
-
Use the command
kubectl get servicesto get a list of Kubernetes services. The output will look like this (the actual names may be different):NAME
TYPE
CLUSTER-IP
EXTERNAL-IP
PORT(S)
AGE
kubernetes
ClusterIP
10.96.0.1
<none>
443/TCP
1d
marklogic
ClusterIP
10.109.182.205
<none>
8000/TCP, 8001/TCP, 8002/TCP
1d
marklogic-headless
ClusterIP
None
<none>
7997/TCP,7998/TCP,7999/TCP,8000/
TCP,8001/TCP,8002/TCP
1d
-
The service you are looking for ends with
marklogicand has aCLUSTER-IPvalue other thanNone. In the example above,marklogicis the service name for the ClusterIP service. The row is shown in bold.
Additional ports
When you create a new application server on MarkLogic, you must add the new server port to additionalPorts in the service configuration:
For example:
## @param service.additionalPorts. Additional ports exposed at the service level.
## Example:
## - name: app1
## port: 8010
## targetPort: 8010
## protocol: TCP
additionalPorts:
- name: app-server1
port: 8010
targetPort: 8010
protocol: TCP
Use the DNS record
For each Kubernetes ClusterIP service, a DNS record with this format is created:
<service-name>.<namespace-name>.svc.cluster.local
For example, if the service name is marklogic and the namespace name is default, the DNS name for the MarkLogic cluster is marklogic.default.svc.cluster.local.
Because a StatefulSet is used for the MarkLogic deployment, the DNS name for each pod is created from the headless service:
<pod-name>.<headless-service-name>.<namespace-name>.svc.cluster.local
For example, if the pod name is marklogic-0, the headless service name is marklogic-headless, and the namespace name is default, the DNS name for the marklogic-0 pod is marklogic-0.marklogic-headless.default.svc.cluster.local.
You can use the DNS name to access a MarkLogic cluster or an individual pod if your applications are deployed in the same Kubernetes cluster.
Use the port-forward command
Use the kubectl port-forward command to access MarkLogic from outside the Kubernetes cluster. You can use it to access either a specific pod or the whole cluster.
Forward to pod
To access a pod directly, use the kubectl port-forward command with this format:
kubectl port-forward pod/<POD-NAME> <LOCAL-PORT>:<CONTAINER-PORT> -n <release-namespace>
For example, enter this command to forward port 8000 from the MarkLogic pod to localhost:
kubectl port-forward pod/marklogic-0 8000:8000 -n <release-namespace>
This pod can now be accessed from http://localhost:8001.
Forward to service
To access the whole cluster, use the kubectl port-forward command with this format:
kubectl port-forward svc/<SERVICE-NAME> <LOCAL-PORT>:<CONTAINER-PORT> -n <release-namespace>
For example, enter this command to forward port 8000 from the MarkLogic service to localhost:
kubectl port-forward svc/marklogic 8000:8000 -n <release-namespace>
This pod can now be accessed via http://localhost:8001.