Question
Accessing a service using my own domain, without setting the ip in the nameserver
I have a grafana dashboard, an nginx-ingress and an OpenVPN service running in my cluster just fine, and I am able to reach everything I need using the cluster IP, but I want to use a domain name, lets say grafana.my-domain.com. How can I achieve this?
This might be some usefull information:
My grafana service:
▶ k get svc --namespace monitoring
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
doks-cluster-monitoring-grafana ClusterIP 10.245.162.148 <none> 80/TCP 120m
My OpenVPN service:
▶ k get svc --namespace access
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
openvpn ClusterIP 10.245.122.233 <none> 1194/TCP 56m
My nginx-ingress:
▶ k get svc --namespace nginx-ingress
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
nginx-ingress-controller LoadBalancer 10.245.199.175 xxx.xxx.xxx.xxx 80:31883/TCP,443:32254/TCP,1194:32021/TCP 48m
nginx-ingress-controller-metrics ClusterIP 10.245.185.36 <none> 9913/TCP 48m
nginx-ingress-default-backend ClusterIP 10.245.242.220 <none> 80/TCP 48m
My CoreDNS:
▶ k get svc --namespace kube-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kube-dns ClusterIP 10.245.0.10 <none> 53/UDP,53/TCP,9153/TCP 143m
My /etc/resolv.conf:
▶ cat /etc/resolv.conf
# Generated by NetworkManager
search localdomain
nameserver 10.245.0.10
nameserver 192.168.1.1
My CoreDNS configmap:
▶ k describe cm --namespace kube-system coredns
Name: coredns
Namespace: kube-system
Labels: <none>
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","data":{"Corefile":".:53 {\n errors\n health\n ready\n kubernetes cluster.local in-addr.arpa ip6.arpa {\n ...
Data
====
Corefile:
----
.:53 {
errors
health
ready
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
fallthrough in-addr.arpa ip6.arpa
}
prometheus :9153
forward . /etc/resolv.conf
cache 30
loop
reload
loadbalance
}
Events: <none>
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×