How to set dns for applications deployed on kubernetes?

69 Views Asked by At

I'm running my angular service with Node IP and NodePort. Now I want to set some dns name for my angular application. Where do I need to set the dns name for Node IP and NodePort? Is there any config file that I need to change? example: 10.10.10.10/34781(my angular running) expecting: myangular.deploy.com (How to set this?)

Im expecting to run my application with dns and not with IP and port. Thanks in advance.

1

There are 1 best solutions below

0
Harsh Manvar On BEST ANSWER

You have to use the ingress to expose the service to internet.

Ingress is managed by the ingress controller, you can check this very simple official k8s example.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: minimal-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  ingressClassName: nginx-example
  rules:
  - http:
      paths:
      - path: /testpath
        pathType: Prefix
        backend:
          service:
            name: test
            port:
              number: 80

Read more : https://kubernetes.io/docs/concepts/services-networking/ingress/

However if you are looking for internal communication if your Node and Angular services running in same K8s cluster you can the sericename itself as the internal communication.