Integrating into a corporate DNS zone
To integrate a Managed Service for Kubernetes cluster into a private corporate DNS zone:
If you no longer need the resources you created, delete them.
Getting started
In this scenario's examples, the DNS server has the address 10.129.0.3
, the name ns.example.com
, and serves a zone called example.com
. Your DNS servers can be part of Virtual Private Cloud or accessible via VPN. IP connectivity between the Managed Service for Kubernetes cluster nodes and the DNS servers is required.
-
Create Kubernetes resources:
-
Create a Managed Service for Kubernetes cluster with the Public address setting :
Auto
. -
Create a node group in any suitable configuration.
-
-
Install kubectl
and configure it to work with the created cluster.
Configure the DNS server
When setting up the configuration, it is important that there is IP connectivity between the Managed Service for Kubernetes cluster nodes and the DNS servers. The example below assumes that the DNS server has the 10.129.0.3
address and the ns.example.com
name and serves a zone called example.com
.
Specify a corporate DNS zone
-
Create a
custom-zone.yaml
file with the following contents:kind: ConfigMap apiVersion: v1 metadata: name: coredns-user namespace: kube-system labels: addonmanager.kubernetes.io/mode: EnsureExists data: Corefile: | # User can put their additional configurations here, for example: example.com { errors cache 30 forward . 10.129.0.3 }
-
Run this command:
kubectl replace -f custom-zone.yaml
Result:
configmap/coredns-user replaced
Create a dns-utils pod
-
Create a pod:
kubectl run jessie-dnsutils \ --image=k8s.gcr.io/jessie-dnsutils \ --restart=Never \ --command sleep infinity
Result:
pod/jessie-dnsutils created
-
View details of the pod created:
kubectl describe pod jessie-dnsutils
Result:
... Status: Running ...
Verify DNS integration
Run the nslookup
command in the running cluster:
kubectl exec jessie-dnsutils -- nslookup ns.example.com
Result:
Server: 10.96.128.2
Address: 10.96.128.2#53
Name: ns.example.com
Address: 10.129.0.3
Delete the resources you created
The Managed Service for Kubernetes cluster is not free of charge. To avoid paying for it, delete it if you no longer need it.