<p>I'm looking at microk8s to host my application and it will be using ingress.
Currently it is deployed on AWS for development system and will be soon moved to an Onprem System</p>
<p>To access the application i have to simply provide the external hostname of AWS and it pulls the application page without any issue.</p>
<pre><code>kubectl create deployment web --image=gcr.io/google-samples/hello-app:1.0

kubectl expose deployment web --type=NodePort --port=8080

web          NodePort    10.152.183.37    &lt;none&gt;        8080:30631/TCP   34m
web2         NodePort    10.152.183.226   &lt;none&gt;        8080:30881/TCP   25m

</code></pre>
<p>Now if i use the AWS hostname it is showing up as expected</p>
<pre><code>Hello, world!
Version: 2.0.0
Hostname: web2-8474c56fd-kb8nx
</code></pre>
<p>So far everything works as expected. Now on Microk8s I have created an Ingress
with the below details:</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: http-ingress
spec:
  rules:
    - http:
      paths:
      - path: /
        backend:
          serviceName: web
          servicePort: 8080
      - path: /v2
        backend:
          serviceName: web2
          servicePort: 8080
</code></pre>
<p>This also works as expected.</p>
<p>Now is there a way i can mask the AWS hostname which is ec2-<em><strong>-</strong>-**-</em>.us-east-2.compute.amazonaws.com to something that i would want to choose or customize. For example a3.myweb.com</p>
<p>I saw that this is possible in minikube/kubernetes using &quot;host&quot; attribute</p>
<p>What is the best way to mask the hostname of AWS/anyserver with a custom name????</p>
<p>Since we were using NGINX as a reverse proxy we were able to do it with providing the hostname in the conf.d/ssl.conf file</p>
<pre><code>server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    
    server_name a1-staging.mycomp.com;
    
    ssl_certificate /etc/pki/tls/certs/a1.crt;
    ssl_certificate_key /etc/pki/tls/private/a1.key;
</code></pre>
<p>Can i achieve something similar in the micok8s setup with Ingress or anything else that the community suggest???</p>
<p>Thank you,
Anish</p>

<p>Ingress <a href="https://v1-18.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#ingressrule-v1beta1-networking-k8s-io" rel="nofollow noreferrer">rules</a> can have a <code>host</code> property</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: http-ingress
spec:
  rules:
    - host: 'a3.myweb.com'
      http:
        paths:
        - path: /
          backend:
            serviceName: web
            servicePort: 8080
        - path: /v2
          backend:
            serviceName: web2
            servicePort: 8080
</code></pre>
