<p>I'd like to design my next project in a microservices-based architecture rather than as a monolith. Are microservices generally defined as a set of endpoints that compromise a service (i.e. common dependencies, functionality, etc.) or would each endpoint be its own service? </p>

<p>I've used <a href="https://serverless.com/" rel="nofollow noreferrer">Serverless Framework</a> before, which defines each endpoint with its dependencies and packages it into a Lambda/FaaS. In Kubernetes is this analogous to each endpoint living in its own pod?</p>

<p>I'm having some trouble thinking about the ideal way to design a new project from the ground up that can make use of autoscaling, microservices, and pay-for-usage, and haven't found much information around it.</p>

<p>Any thoughts/resources on this subject?</p>

rhlsthrm
<p>I would recommend you to start from <a href="https://dzone.com/articles/kubernetes-autoscaling-explained" rel="nofollow noreferrer">scaling</a> perspective. Separate apps that should be scaled from apps that shouldn't. That would be <a href="https://kubernetes.io/docs/concepts/workloads/pods/pod/" rel="nofollow noreferrer">Pods</a>.  </p>

<p>Define the connection between apps taking into account fault tolerance and load balancing. Define the autodiscovery strategy. That's what <a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="nofollow noreferrer">Services</a> is used for.   </p>

<p>Think about how you expose your apps to the outside world. That's what <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="nofollow noreferrer">Ingress</a> is for.</p>

<p>Think about how you restart and update your apps. That's what <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/" rel="nofollow noreferrer">Deployments</a> do.</p>

<p>Think about cluster security. This is where <a href="https://kubernetes.io/docs/concepts/services-networking/network-policies/" rel="nofollow noreferrer">Network policies</a> come to play. Project Calico provides more flexible <a href="https://docs.projectcalico.org/v3.1/reference/calicoctl/resources/networkpolicy" rel="nofollow noreferrer">solution</a>.</p>

<p>Think about the availability of the whole cluster. Here come the <a href="https://thenewstack.io/kubernetes-high-availability-no-single-point-of-failure/" rel="nofollow noreferrer">Kubernetes HA clusters</a></p>

<p>In special cases you may need to use <a href="https://hackernoon.com/kubernetes-101-daemonsets-5-c5bbfcbb1579" rel="nofollow noreferrer">DaemonSets</a>, <a href="https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/" rel="nofollow noreferrer">Jobs</a>, <a href="https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/" rel="nofollow noreferrer">CronJobs</a> and <a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/" rel="nofollow noreferrer">StatefulSets</a>.</p>

<p>If you decide to go deeper, check out other articles in the <a href="https://kubernetes.io/docs/concepts/" rel="nofollow noreferrer">Kubernetes concepts</a> section of the official site.</p>
