In Openshift I am used to expose my service outside the cluster through a route. That will automatically create a new "domain name" that I can use to access my application from e.g. my local PC on the local network.
That new doman name is not automatically made public to the internet but it works automatically on the local network so I assume there is some DNS server running - maybe as part of the OpenShift platform - where these routes/DNS names gets added/removed from automatically.
Now I am working on kubernetes and have created an Ingress object for my service/application:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
name: my-app
namespace: my-ns
spec:
rules:
- host: ???
http:
paths:
- backend:
serviceName: my-app
servicePort: 8080
path: /hello
But how do I fill out the host?
Do I manually have to contact the DNS server admin each time I need to do this and get him to create a new DNS record with a uniqe name on the local network?
Or is there some standard/automated way to do this in Kubernetes - similar to OpenShift?
By default, kubeadm init deploys a cluster that assigns services with DNS names
<service_name>.<namespace>.svc.cluster.local
. You can use the--service-dns-domain
to change the DNS name suffix. Again, you will need to update the/etc/systemd/system/kubelet.service.d/10-kubeadm.conf
file accordingly else DNS will not function correctly.You may find How to change the cluster.local default domain on kubernetes 1.9 deployed with kubeadm? useful for yourself.
IN case you have(maybe in a future) an external DNS providers - you may want to look into ExternalDNS direction.
Of course you should refer to particular documentation, depending on your requirements. Configuration example for GKE: Setting up ExternalDNS on Google Container Engine
Well, you fill it out manually with the domain name, for which you've configured
A
record pointing to ingress IP on your local DNS. That's all.If you use it only locally is it really important that it is resolvable through your local DNS server ? You can simply add this domain to your
/etc/hosts
file telling only your local machine that such and such domain resolves certain IP in your local network.I'm not very familiar with Openshift so I'm not able to tell you how exactly this feature is implemented but I'm quite sure there is nothing like what you describe, available in Kubernetes.