<p>I have a local Kubernetes cluster based on <a href="https://microk8s.io/" rel="nofollow noreferrer">MicroK8s</a> running on an Ubuntu 18.04 machine.</p>

<p><strong>What I want to achieve:</strong> Generally I want to expose my applications to DNS names and test them locally.</p>

<p><strong>My setup:</strong> </p>

<p>I created the following test deployment </p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-app
  labels:
    app: hello-app
    tier: backend
    version: v1
spec:
  selector:
    matchLabels:
      app: hello-app
  replicas: 2
  template:
    metadata:
      labels:
        app: hello-app
    spec:
      containers:
      - name: hello-app
        image: localhost:5000/a-local-hello-image
        ports:
        - containerPort: 3000
</code></pre>

<p>I added the following service descriptor:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: hello-app
spec:
  selector:
    app: hello-app
  ports:
    - protocol: TCP
      port: 3000
      targetPort: 3000
</code></pre>

<p>Now I want to see my app available, let's say, at <code>http://hello.someurl.com:3000</code>.</p>

<p><strong>Question:</strong> What do I need to setup in addition to my current configuration to map my application to a DNS name locally?</p>

<p><strong>Note:</strong> I have read <a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/" rel="nofollow noreferrer">the documentation</a> which unfortunately didn't help. I also <a href="https://microk8s.io/docs/addon-dns" rel="nofollow noreferrer">enabled DNS addon</a> on my cluster. </p>

<p>I would appreciate any help, any directions on how to move forward.</p>

Sasha Shpota
<p>The easiset way to achieve what you want would be using</p>

<pre><code>kubectl port-forward service/hello-app 3000:3000
</code></pre>

<p>and appending following entry to <code>/etc/hosts</code> file</p>

<pre><code>127.0.0.1 hello.someurl.com
</code></pre>

<p>Then you can just open your browser and go to <code>http://hello.someurl.com:3000</code></p>
