How to Implement a specific /etc/resolv.conf per Openshift project
Personally I think the OpenShift
has not been supported configuration of DNS
per a project
unit. But you can consider the CustomPodDNS
feature to configure DNS
per Pod
unit. So you might configure the Pods
to use same DNS
config in a project
using this feature.
- You can enable the
CustomPodDNS
feature forOCP
cluster, if you configure the following parameters in/etc/origin/master/master-config.yaml
.
kubernetesMasterConfig: apiServerArguments: feature-gates: - CustomPodDNS=true controllerArguments: feature-gates: - CustomPodDNS=true
- You can also enable this feature on one node host as configuring it in the
/etc/origin/node/node-config.yaml
.
kubeletArguments: feature-gates: - CustomPodDNS=true
You should restart the related services master
and node
to take effect the changes.
- The config of
Pod
, refer Pod's Config for more details.
apiVersion: v1kind: Podmetadata: namespace: default name: dns-examplespec: containers: - name: test image: nginx dnsPolicy: "None" dnsConfig: nameservers: - 1.2.3.4 searches: - ns1.svc.cluster.local - my.dns.search.suffix options: - name: ndots value: "2" - name: edns0