<p>I need help to create a reverse zone for the external IP of Kubernetes Ingress Website or something that do the some function like a reverse zone.</p>
<p>Basically I need that when I enter the IP of the ingress in the browser, redirects me to the domain name.</p>
<p>Thanks for the help.</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: prueba-web-ingress
 annotations:
  nginx.ingress.kubernetes.io/permanent-redirect: http://example.com
  networking.gke.io/managed-certificates: certificateexample
  kubernetes.io/ingress.global-static-ip-name: test
  kubernetes.io/ingress.allow-http: &quot;false&quot;
spec:
    backend:
           serviceName: prueba-web
           servicePort: 80
</code></pre>

IFP GODS
<p>Try the following, just change the <code>example.com</code> to your domain:</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: reverse-redirect
  annotations:
    nginx.ingress.kubernetes.io/permanent-redirect: http://example.com
spec:
  rules:
  - http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: &quot;somerandomname&quot; # needs some name, doesn't need to exist
            port:
              number: 80
</code></pre>
<p>When sending a request to nginx ingress without <code>Host</code> header, it will default to the ingress without specified <code>host</code> filed (just like the example above). Such request will receive a following response:</p>
<pre><code>$ curl 123.123.123.123 -I
HTTP/1.1 301 Moved Permanently
Date: Wed, 28 Apr 2021 11:36:05 GMT
Content-Type: text/html
Content-Length: 162
Connection: keep-alive
Location: http://example.com
</code></pre>
<p>Browser receiving this redirect, will redirect to the domain specified in <code>Location</code> header.</p>
<p>Docs:</p>
<ul>
<li><a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#permanent-redirect" rel="nofollow noreferrer">permanent redirect annotation</a></li>
</ul>
<hr />
<h3>EDIT:</h3>
<p>Since you are not using nginx ingress you can try to use a redirect app.</p>
<p>Here is a deployment with some random image I have found on dockerhub that responds to every request with redirect. I don't want to lecture you on security but I feel that I should at leat mention that you should never use random container images from the internet, and if you are, you are doing it on your own resposibiliy. Preferably build one from source and push to your own repo.</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: redir
  name: redir
spec:
  replicas: 1
  selector:
    matchLabels:
      app: redir
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: redir
    spec:
      containers:
      - image: themill/docker-nginx-redirect-301
        name: docker-nginx-redirect-301
        env:
        - name: REDIRECT_CODE
          value: &quot;302&quot;
        - name: REDIRECT_URL
          value: https://example.com
</code></pre>
<hr />
<p>Service for the above deployment:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  labels:
    app: redir
  name: redir
spec:
  ports:
  - port: 80
    protocol: TCP
    targetPort: 80
  selector:
    app: redir
status:
  loadBalancer: {}
</code></pre>
<hr />
<p>Now the ingress part:</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: prueba-web-ingress
 annotations:
  networking.gke.io/managed-certificates: certificateexample
  kubernetes.io/ingress.global-static-ip-name: test
  kubernetes.io/ingress.allow-http: &quot;false&quot;
spec:
  rules:
  - http:
      paths:
      - path: /
          backend:
            serviceName: redir
            servicePort: 80
  - host: example.com
    http:
      paths:
      - path: /
         backend:
           serviceName: prueba-web
           servicePort: 80
</code></pre>
<p>Notice the same applies here: no <code>host</code> field set for redir service, although prueba-web service has its host filed set.</p>
