Mohammed Naser | 9ad0d46 | 2023-01-15 20:36:37 -0500 | [diff] [blame] | 1 | {{- if .Values.isClusterService }} |
| 2 | CoreDNS is now running in the cluster as a cluster-service. |
| 3 | {{- else }} |
| 4 | CoreDNS is now running in the cluster. |
| 5 | It can be accessed using the below endpoint |
| 6 | {{- if contains "NodePort" .Values.serviceType }} |
| 7 | export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "coredns.fullname" . }}) |
| 8 | export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") |
| 9 | echo "$NODE_IP:$NODE_PORT" |
| 10 | {{- else if contains "LoadBalancer" .Values.serviceType }} |
| 11 | NOTE: It may take a few minutes for the LoadBalancer IP to be available. |
| 12 | You can watch the status by running 'kubectl get svc -w {{ template "coredns.fullname" . }}' |
| 13 | |
| 14 | export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "coredns.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') |
| 15 | echo $SERVICE_IP |
| 16 | {{- else if contains "ClusterIP" .Values.serviceType }} |
| 17 | "{{ template "coredns.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local" |
| 18 | from within the cluster |
| 19 | {{- end }} |
| 20 | {{- end }} |
| 21 | |
| 22 | It can be tested with the following: |
| 23 | |
| 24 | 1. Launch a Pod with DNS tools: |
| 25 | |
| 26 | kubectl run -it --rm --restart=Never --image=infoblox/dnstools:latest dnstools |
| 27 | |
| 28 | 2. Query the DNS server: |
| 29 | |
| 30 | / # host kubernetes |