Faced the following issue: I need to add a search domain on some pods to be able to communicate with headless service. Kubernetes documentation recommends to set a dnsConfig and set everything in it.That's what I did. Also there is a limitation that only 6 search domains can be set. Part of the manifest:
spec:
hostname: search
dnsPolicy: ClusterFirst
dnsConfig:
searches:
- indexer.splunk.svc.cluster.local
containers:
- name: search
Unfortunately it has no effect and resolv.conf file on targeted pod doesn't include this search domain:
search splunk.svc.cluster.local svc.cluster.local cluster.local us-east4-c.c.'project-id'.internal c.'project-id'.internal google.internal
nameserver 10.39.240.10
options ndots:5
After a quick look at this config I found that currently there are 6 search domens are specified and probably this is the reason why new search domain is not added. You can add manually and everything will work,but this isn't what I 'm trying to achieve.
Do you have any ideas how to bypass this limitation?
P.S Set dnsPolicy to None is not an option also as set prestart hooks to add my search zone.
---
# Search-head deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: search
namespace: splunk
labels:
app: splunk
spec:
replicas: 1
selector:
matchLabels:
app: splunk
template:
metadata:
labels:
app: splunk
spec:
hostname: search
dnsPolicy: ClusterFirst
dnsConfig:
searches:
- indexer.splunk.svc.cluster.local
containers:
- name: search
image: splunk/splunk
env:
- name: SPLUNK_START_ARGS
value: "--accept-license"
- name: SPLUNK_PASSWORD
valueFrom:
secretKeyRef:
name: splunk-password
key: password
- name: SPLUNK_ROLE
value: splunk_search_head
- name: SPLUNK_SEARCH_HEAD_URL
value: search
- name: SPLUNK_INDEXER_URL # TODO: make this part dynamic.
value: indexer-0,indexer-1
ports:
- name: web
containerPort: 8000
- name: mgmt
containerPort: 8089
- name: kv
containerPort: 8191
volumeMounts:
- mountPath: /opt/splunk/var
name: sh-volume
volumes:
- name: sh-volume
persistentVolumeClaim:
claimName: sh-volume