@@ -5,11 +5,137 @@ description: External DNS with FreeIPA
55tags : ['dns','freeipa']
66---
77
8- # External DNS with FreeIPA
8+ # External DNS with FreeIPA (RFC2136)
99
10- ## Resources
10+ Sadly the External DNS Operator do not support RFC2136. Let's use the upstream one.
1111
12- * < https://astrid.tech/2021/04/18/0/k8s-freeipa-dns/ >
13- * < https://bind9.readthedocs.io/en/v9.16.20/reference.html#dynamic-update-policies >
14- * < https://github.com/kubernetes-sigs/external-dns/blob/master/docs/tutorials/rfc2136.md >
15- * < https://access.redhat.com/solutions/203473q >
12+ Thanks to < https://astrid.tech/2021/04/18/0/k8s-freeipa-dns/ > for the starting point.
13+
14+ ## Prepare IPA DNS Zone
15+
16+ ### Generate a TSIG key and register it
17+
18+ ``` bash
19+ dnssec-keygen -a HMAC-SHA512 -b 512 -n HOST openshift-external-dns
20+ ```
21+
22+ ``` bash
23+ $ cat Kopenshift-external-dns.+165+16478.private
24+ Private-key-format: v1.3
25+ Algorithm: 165 (HMAC_SHA512)
26+ Key: c3LyD11u....xX6WA==
27+ Bits: AAA=
28+ Created: 20240205134832
29+ Publish: 20240205134832
30+ Activate: 20240205134832
31+ ```
32+
33+ ### Configure the key at ipa server and all replicas
34+
35+ ``` bash
36+ $ cat /etc/named/ipa-ext.conf
37+ ...
38+ key " openshift-external-dns" {
39+ algorithm hmac-sha512;
40+ secret " c3LyD11u....xX6WA==" ;
41+ };
42+
43+ ```
44+ ### Allow DNS updates and zone transfer for the key:
45+
46+ Select the zone you want to manage, in my example ` .disco.local ` :
47+
48+ * Enable ` Dynamic update `
49+ * Add ` grant openshift-external-dns subdomain disco.local ANY ; ` to BIND update policy
50+ Details about the policy configuration you can [ here] ( https://bind9.readthedocs.io/en/v9.16.20/reference.html#dynamic-update-policies )
51+
52+ ![ Screenshot] ( ipa.png )
53+
54+ * Configure ` Allow transfer ` is not possible via WebUI. [ Because] ( https://www.freeipa.org/page/Howto/DNS_updates_and_zone_transfers_with_TSIG )
55+
56+ ??? example "ldap search example"
57+
58+ At the ipa server
59+ ```bash
60+ # kinit admin
61+ Password for admin@DISCO.LOCAL:
62+ # ldapsearch idnsname=disco.local. dn idnsAllowTransfer
63+ SASL/GSSAPI authentication started
64+ SASL username: admin@disco.local
65+ SASL SSF: 256
66+ SASL data security layer installed.
67+ # extended LDIF
68+ #
69+ # LDAPv3
70+ # base <cn=dns,dc=disco,dc=local> (default) with scope subtree
71+ # filter: idnsname=disco.local.
72+ # requesting: dn idnsAllowTransfer
73+ #
74+
75+ # disco.local., dns, disco.local
76+ dn: idnsname=disco.local.,cn=dns,dc=disco,dc=local
77+ idnsAllowTransfer: none;
78+
79+ # search result
80+ search: 4
81+ result: 0 Success
82+
83+ # numResponses: 2
84+ # numEntries: 1
85+ #
86+ ```
87+
88+ ``` bash
89+ kinit admin
90+
91+ ldapmodify -Y GSSAPI << EOF
92+ dn: idnsname=coe.muc.redhat.com.,cn=dns,dc=disco,dc=local
93+ changetype: modify
94+ replace: idnsAllowTransfer
95+ idnsAllowTransfer: key openshift-external-dns;
96+ -
97+ EOF
98+
99+ ` ` `
100+
101+ # # Deploy External DNS
102+
103+ based on [Configuring RFC2136 provider](https://github.com/kubernetes-sigs/external-dns/blob/master/docs/tutorials/rfc2136.md)
104+
105+ ??? example " Deployment"
106+
107+ === " YAML"
108+
109+ ` ` ` yaml
110+ --8<-- "content/cluster-configuration/external-dns/deployment/namespace.yaml"
111+ --8<-- "content/cluster-configuration/external-dns/deployment/serviceaccount.yaml"
112+ --8<-- "content/cluster-configuration/external-dns/deployment/clusterrole.yaml"
113+ --8<-- "content/cluster-configuration/external-dns/deployment/clusterrolebinding.yaml"
114+ --8<-- "content/cluster-configuration/external-dns/deployment/deployment.yaml"
115+ ` ` `
116+ === " oc apply -k ...."
117+
118+ ` ` ` bash
119+ oc apply -k https://github.com/openshift-examples/web/tree/main/content/cluster-configuration/external-dns/deployment/
120+ ` ` `
121+
122+ Check the logs of the external-dns pod
123+
124+ ` ` ` bash
125+ oc logs -n infra-external-dns deployment/external-dns
126+ ` ` `
127+
128+ # # Example deployment
129+
130+ * Required MetalLB or support of service type LoadBalancer.
131+
132+ ` ` ` bash
133+ oc new-project external-dns-demo
134+
135+ oc apply -f {{ page.canonical_url }}../../deploy/deployment-simple-nginx.yaml
136+
137+ oc patch service/simple-nginx --type merge -p '{"spec":{"type":"LoadBalancer"}}'
138+
139+ oc annotate service/simple-nginx external-dns.alpha.kubernetes.io/hostname="external-dns-demo.disco.local"
140+ oc annotate service/simple-nginx external-dns.alpha.kubernetes.io/ttl: '60'
141+ ` ` `
0 commit comments