Exposing CoreDNS to external requests
We have already covered how to deploy most of the resources that you need to integrate – ETCD, ExternalDNS, and configuring CoreDNS with a new zone that is ETCD-integrated. To provide external access to CoreDNS, we need to create a new service that exposes CoreDNS on TCP and UDP port 53
. A complete service manifest is shown below.
apiVersion: v1
kind: Service
metadata:
labels:
k8s-app: kube-dns
kubernetes.io/cluster-service: "true"
kubernetes.io/name: CoreDNS
name: kube-dns-ext
namespace: kube-system
spec:
ports:
- name: dns
port: 53
protocol: UDP
targetPort: 53
selector:
k8s-app: kube-dns
type: LoadBalancer
loadBalancerIP: 10.2.1.74
There is one new option in the service that we haven’t discussed yet – we have added the spec.loadBalancerIP
to our deployment. This option allows you to assign an IP address to the service so it will have a stable IP address,...