<p>I'm trying to override dnsconfig (searchdomain particularly) of my alpine based pod.</p>

<p>But it seems <a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-config" rel="nofollow noreferrer">dnsconfig</a> is available in pod object.</p>

<p>Is there anyway to provide dnsconfig in deployment object or any other workaround to override searchdomain of that particular pod.</p>

<p>You can specify the <a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-config" rel="nofollow noreferrer"><code>dnsConfig</code></a> inside <code>spec.template</code> object.</p>

<p>This is basically a template for your <code>Deployment</code> which will be used to create pods.</p>

<p>Deployment might look like the following:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.17
        ports:
        - containerPort: 80
      dnsPolicy: "None"
      dnsConfig:
        nameservers:
          - 1.2.3.4
        searches:
          - test.test.com
          - test.test.org
</code></pre>
