dns-injector
Allow to inject dnsPolicy and dnsConfig settings through annotations.
Dependencies
- cert-manager with ca-injector
Installation
- Add Helm repo
helm repo add ydkn https://repo.ydkn.io/charts
- Install the chart on your cluster
helm install dns-injector ydkn/dns-injector
See deploy/charts/dns-injector/values.yaml
for configuration options.
Usage
To enable the dns-injector any pod that should be modified needs to have the following label:
dns-injector.ydkn.io/enabled: "true"
Change the DNS policy of a pod
Add a pod with the dns-injector.ydkn.io/policy
annotation with the DNS policy value:
apiVersion: v1
kind: Pod
metadata:
name: dns-example
labels:
dns-injector.ydkn.io/enabled: "true"
annotations:
dns-injector.ydkn.io/policy: None
spec:
containers:
- name: nginx
image: nginx
This results in the following pod to be scheduled:
apiVersion: v1
kind: Pod
metadata:
name: dns-example
labels:
dns-injector.ydkn.io/enabled: "true"
annotations:
dns-injector.ydkn.io/policy: None
spec:
containers:
- name: nginx
image: nginx
dnsPolicy: None
Change the DNS config of a pod
Create a configmap with a dnsConfig:
apiVersion: v1
kind: ConfigMap
metadata:
name: my-dnsconfig
data:
dnsConfig.yaml: |
nameservers:
- 1.2.3.4
options:
- name: ndots
value: "0"
Add a pod with the dns-injector.ydkn.io/configmap
annotation and the name of the configmap as the value:
apiVersion: v1
kind: Pod
metadata:
name: dns-example
labels:
dns-injector.ydkn.io/enabled: "true"
annotations:
dns-injector.ydkn.io/configmap: my-dnsconfig
spec:
containers:
- name: nginx
image: nginx
This results in the following pod to be scheduled:
apiVersion: v1
kind: Pod
metadata:
name: dns-example
labels:
dns-injector.ydkn.io/enabled: "true"
annotations:
dns-injector.ydkn.io/configmap: my-dnsconfig
spec:
containers:
- name: nginx
image: nginx
dnsConfig:
nameservers:
- 1.2.3.4
options:
- name: ndots
value: "0"
Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
)
- Commit your Changes (
git commit -m 'Add some AmazingFeature'
)
- Push to the Branch (
git push origin feature/AmazingFeature
)
- Open a Merge Request
License
Distributed under the MIT License. See LICENSE.txt
for more information.