kubernetes-the-hard-way/docs/10-dns.md

36 lines
781 B
Markdown
Raw Normal View History

2023-05-22 23:39:31 +03:00
# DNS in Kubernetes
2023-05-22 23:39:31 +03:00
Again, it is very interesting to access the service by ip but we know that we can access it by service name
Lets try,
```bash
2023-05-22 23:39:31 +03:00
kubectl exec busy-box -- wget -O - nginx-service
```
2023-05-22 23:39:31 +03:00
and nothing happen
2023-05-22 23:39:31 +03:00
the reason is DNS server which we still not configured
but dns server we can install from kubernetes directly
```bash
kubectl apply -f https://storage.googleapis.com/kubernetes-the-hard-way/coredns-1.8.yaml
```
2023-05-22 23:39:31 +03:00
and try to erpeat
```bash
2023-05-22 23:39:31 +03:00
kubectl exec busy-box -- wget -O - nginx-service
```
2023-05-22 23:39:31 +03:00
Output:
```
Hello from pod: nginx-deployment-68b9c94586-zh9vn
Connecting to nginx-service (10.32.0.230:80)
writing to stdout
- 100% |********************************| 50 0:00:00 ETA
written to stdout
```
great, everything works as expected