<p>I am having trouble testing my application locally, due to my machine having memory constraints.</p>

<p>My application utilizes about 10 different microservices where each service has shared/non-shared AWS resources. Up until now, I've been using <code>localstack</code> to deploy all required AWS mock services and docker to spin up the other dependent microservices. However, I think the overall system has gotten too large for my machine to handle. The only option I could think of is to leverage kubernetes then deploying everything to AWS for testing. I'm hesitant on doing so, as I don't want to spend money on a volunteer project.</p>

<p>Are there any other options to achieve this? Or should I just bite the bullet and pay on-demand?
Thanks in advance.</p>

Daniel Kim
<p>First you should be setting resource requests and resource limits on your containers, this way you will have a control over the resources you assign/use.
This is nicely explained on <a href="https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/" rel="nofollow noreferrer">Managing Compute Resources for Containers</a>.</p>

<blockquote>
  <p>Limits and requests for  <code>memory</code>  are measured in bytes. You can express memory as a plain integer or as a fixed-point integer using one of these suffixes: E, P, T, G, M, K. You can also use the power-of-two equivalents: Ei, Pi, Ti, Gi, Mi, Ki. For example, the following represent roughly the same value:</p>
  
  <pre class="lang-sh prettyprint-override"><code>128974848, 129e6, 129M, 123Mi
</code></pre>
</blockquote>

<p>Your <code>Pod</code> might look like this:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: frontend
spec:
  containers:
  - name: db
    image: mysql
    env:
    - name: MYSQL_ROOT_PASSWORD
      value: "password"
    resources:
      requests:
        memory: "64Mi"
        cpu: "250m"
      limits:
        memory: "128Mi"
        cpu: "500m"
  - name: wp
    image: wordpress
    resources:
      requests:
        memory: "64Mi"
        cpu: "250m"
      limits:
        memory: "128Mi"
        cpu: "500m"
</code></pre>

<blockquote>
  <p>The following Pod has two Containers. Each Container has a request of 0.25 cpu and 64MiB (226 bytes) of memory. Each Container has a limit of 0.5 cpu and 128MiB of memory. You can say the Pod has a request of 0.5 cpu and 128 MiB of memory, and a limit of 1 cpu and 256MiB of memory.</p>
</blockquote>

<p>Second, once you have your <code>yaml</code> deployments written down you can deploy them anywhere you want.</p>

<p>You can have a test run on <a href="https://cloud.google.com/" rel="nofollow noreferrer">GCP</a> using their <a href="https://cloud.google.com/free/" rel="nofollow noreferrer">Free Tier</a> which gives you $300 of credit for a year.</p>

<p>If you can set low requests you might be even be able to run it on your local machine using <a href="https://kubernetes.io/docs/tasks/tools/install-minikube/" rel="nofollow noreferrer">Minikube</a>.</p>
