<p>I want to expose service to external network with use DNS. For example I have service <code>my-service</code> and I want to expose it as <code>my-service.my-cluster.com</code>.</p>
<ol>
<li>Should I use some proxy (like nginx ...) or Kubernetes support this?</li>
<li>Is DNS should be configured manually or there is some automation.</li>
</ol>
<p>I assume use it to development and production later - maybe different methods is better for both use case.</p>
<p>For example I want to expose this:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  labels:
    app: my-service
  name: my-service
spec:
  type: ClusterIP
  ports:
  - name: http
    port: 80
    targetPort: 80
    protocol: TCP
  selector:
    app: my-service
</code></pre>

Chameleon
<p>Since we are talking of an http service, you should use an <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="nofollow noreferrer">ingress</a>:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: my-service-ingress
spec:
  ingressClassName: your-ingress-controller-class-name
  rules:
  - http:
      paths:
      - path: /your-root
        pathType: Prefix
        backend:
          service:
            name: my-service
            port:
              number: 80
</code></pre>
<p>Basically, an Ingress Controller exposes itself at a Service of type LoadBalancer and creates name-based virtual hosts for each ingress it finds.</p>
<p>Automatic DNS provisioning can be achieved via <a href="https://github.com/kubernetes-sigs/external-dns" rel="nofollow noreferrer">external-dns</a> – under certain circumstances. Namely if you use a supported DNS provider and a compatible ingress controller (most are).</p>
