<p>I am newbie on Docker and Kubernetes. And now I am developing Restful APIs which later be deployed to Docker containers in a Kubernetes cluster. </p>

<p>How the path of the endpoints will be changed? I have heard that Docker-Swarm and Kubernetes add some ords on the endpoints.</p>

user217648
<p>The "path" part of the endpoint URLs themselves (for this SO question, the <code>/questions/53008947/...</code> part) won't change.  But the rest of the URL might.</p>

<p>Docker publishes services at a TCP-port level (<code>docker run -p</code> option, Docker Compose <code>ports:</code> section) and doesn't look at what traffic is going over a port.  If you have something like an Apache or nginx proxy as part of your stack that might change the HTTP-level path mappings, but you'd probably be aware of that in your environment.</p>

<p>Kubernetes works similarly, but there are more layers.  A container runs in a Pod, and can publish some port out of the Pod.  That's not used directly; instead, a Service refers to the Pod (by its labels) and republishes its ports, possibly on different port numbers.  The Service has a DNS name <code>service-name.namespace.svc.cluster.local</code> that can be used within the cluster; you can also configure the Service to be reachable on a fixed TCP port on every node in the service (<code>NodePort</code>) or, if your Kubernetes is running on a public-cloud provider, to create a load balancer there (<code>LoadBalancer</code>).  Again, all of this is strictly at the TCP level and doesn't affect HTTP paths.</p>

<p>There is one other Kubernetes piece, an Ingress controller, which acts as a declarative wrapper around the nginx proxy (or something else with similar functionality).  That <em>does</em> operate at the HTTP level and could change paths.</p>

<p>The other corollary to this is that the URL to reach a service might be different in different environments: <code>http://localhost:12345/path</code> in a local development setup, <code>http://other_service:8080/path</code> in Docker Compose, <code>http://other-service/path</code> in Kubernetes, <code>https://api.example.com/other/path</code> in production.  You need some way to make that configurable (often an environment variable).</p>
