Explore Dns Solution
- How to identify the DNS solution used in a cluster:
kubectl get pods -n kube-system - Usually this is CoreDNS.
kube-dnsis the name of the service for which to access CoreDNS with.- How to check the IP of the CoreDNS server that should be configured on PODS to resolve services?
- Run
kubectl get service -n kube-systemand then check the ClusterIP value.
- Run
- Where is the configuration file kept for configuring the CoreDNS service?
- Check the
Argsfield of the CoreDNS deployment:kubectl -n kube-system describe deployments.apps coredns | grep -A2 Args | grep Corefile
- Check the
- In this example, the answer is
/etc/coredns/Corefile. - How is the Corefile passed into the CoreDNS POD?
- Check the ConfigMaps, run this command
kubectl get cm -n kube-systemand check thecorednsConfigMap. - It is configured as a ConfigMap object.
- Check the ConfigMaps, run this command
- What is the name of the ConfigMap object created for Corefile?
coredns
- How to check the
rootdomain/zone of the cluster?kubectl describe configmap coredns -n kube-system - Example answer is
cluster.local - What name can be used to access the
hrweb server from thetestapplication?- Run
kubectl get svcand get the right service name and port.- The example answer is
web-service.
- The example answer is
- Run
- Anything that has
.podinside of it, cannot be accessed. - Troubleshoot why a web server is unable to access a database pod.
- Run
kubectl edit deploy webapp - Correct the
DB_Hostvalue.- In this case it had to be changed from
mysqltomysql.payroll.
- In this case it had to be changed from
- Run
- From an HR pod,
nslookupthemysqlservice.- Run this command:
kubectl exec -it hr -- nslookup mysql.payroll > /root/CKA/nslookup.out
- Run this command: