<p>I have created a sample spring boot app and did the following:-</p>
<p>1.created a docker image</p>
<p>2.created an Azure container registry and did a docker push to this</p>
<p>3.Created a cluster in Azure Kubernetes service and deployed it successfully.I have chosen external endpoint option for this.</p>
<p><a href="https://i.stack.imgur.com/G9dtB.png" rel="nofollow noreferrer">Kubernetes external end point</a></p>
<p>say for service to service call i dont want to use IP like <a href="http://20.37.134.68:80" rel="nofollow noreferrer">http://20.37.134.68:80</a> but another custom name how can i do it?
Also if i chose internal then is there any way to replace the name.
Tried editing YAML with endpoint name property but failed.Any ideas?</p>

sand87
<p>I think you mixing some concept, so I'll try to explain and help you to reach what you want.</p>
<ol>
<li>When you deploy a container image in a Kubernetes cluster, in the most cases you will use a <a href="https://kubernetes.io/docs/concepts/workloads/pods/" rel="nofollow noreferrer"><code>pod</code></a> or <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/" rel="nofollow noreferrer"><code>deployment</code></a> spec, that basically is a yaml file with all your deployment/pod configuration, name, image name etc. Here is an example of a simple echo-server app:</li>
</ol>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: echo
spec:
  selector:
    matchLabels:
      app: echo
  template:
    metadata:
      labels:
        app: echo
    spec:
      containers:
      - name: echo
        image: mendhak/http-https-echo
        ports:
        - name: http
          containerPort: 80
</code></pre>
<p>Observe the fields <code>name</code> in the file. Here you can configure the name for your deployment and for your containers.</p>
<ol start="2">
<li>In order to <strong>expose</strong> your application, you will need to use a <a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="nofollow noreferrer"><code>service</code></a>. Services can be <code>internal</code> and <code>external</code>. <a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="nofollow noreferrer">Here</a> you can find all service types.</li>
</ol>
<p>For a internal service, you need to use the service type <code>ClusterIP</code> (default), it means only your cluster will reach the pods. To reach your service from other pods, you can use the <a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#srv-records" rel="nofollow noreferrer">service name</a> composed by <code>my-svc.my-namespace.svc.cluster-domain.example</code>.</p>
<p>Here is an example of a service for the deployment above:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: echo-svc
spec:
  selector:
    app: echo
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
</code></pre>
<ol start="3">
<li>To expose your service externally, you have the option to use a service type <code>NodePort</code>, <code>LoadBalancer</code> or use an <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="nofollow noreferrer"><code>ingress</code></a>.</li>
</ol>
<p>You can configure your DNS name in the ingress rules and make path rules if you want, or even configure a HTTPS for your application. There are few options to ingresses in kubernetes, and one of the most popular is <a href="https://kubernetes.github.io/ingress-nginx/" rel="nofollow noreferrer"><code>nginx-ingress</code></a>.</p>
<p>Here is an example of how to configure a simple ingress for our example service:</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/use-regex: &quot;false&quot;
  name: echo-ingress
spec:
  rules:
  - host: myapp.mydomain.com
    http:
      paths:
      - path: &quot;/&quot;
        backend:
          serviceName: echo-svc
          servicePort: 80
</code></pre>
<p>In the example, i'm using the dns name <code>myapp.mydomain.com</code>, so it means you can only will reach your application by this name.</p>
<p>After create the ingress, you can see the external ip with the command <code>kubectl get ing</code>, and you can create a A entry in your dns server.</p>
