Answers: <ul>
  <li>Try to use only <code>n1-standard-1</code> nodes and let the autoscaler do it's magic.</li>
  <li>If you can accept some downtime (and eventually some failures of the CI/CD jobs that should be fixed when you retry) you can <a href="https://cloud.google.com/blog/products/containers-kubernetes/cutting-costs-with-google-kubernetes-engine-using-the-cluster-autoscaler-and-preemptible-vms" rel="nofollow noreferrer">use preemptible nodes</a>.</li>
  <li>Migrate stateless apps to <a href="https://cloud.google.com/run/docs/quickstarts/build-and-deploy" rel="nofollow noreferrer">Cloud Run</a>.</li>
  <li>Follow <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/small-cluster-tuning" rel="nofollow noreferrer">this guide</a> to reduce resource consumption on your cluster.</li>
  </ul>
  
Answers: CC BY-SA 4.0
Answers: 2019-10-10T04:02:19.103Z
Answers: 2019-10-10T04:02:19.103Z
Answers: Laski
Answers: <p>Given that you mentioned rarely using some k8s resources, you could explore some alternatives:</p>
  
  <ul>
  <li>With <code>gcloud SDK</code> you could create scripts to be executed for the periods you want to reduce GKE nodes (even to zero) during periods you're not using it</li>
  <li>With <a href="https://cloud.google.com/functions/docs/" rel="nofollow noreferrer">Google Cloud Functions</a> (GCF) you can create some python/Node.js/Go script to access GKE APIs and also execute the operations to stop/reduce your instances. These GCF could be triggered by schedulers configured by <a href="https://cloud.google.com/scheduler/docs/tut-pub-sub" rel="nofollow noreferrer">Cloud Scheduler</a>. The cost here for such executions will be really low or even zero.</li>
  </ul>
  
Answers: CC BY-SA 4.0
Answers: 2019-10-07T18:22:54.717Z
Answers: 2019-10-07T18:22:54.717Z
Answers: manasouza
Body: <p>I'm paying over $300/month for Kubernetes to have CI/CD in GitLab. And it only covers web apps, Android apps and deployment to Google Cloud. Plus some staging environments, that do not require many resources and that I'm using rarely. It doesn't cover CD to Apple App Store though.</p>
  
  <p>I'm curious if there is a way to optimize this? Maybe I should buy some hardware or optimize Google Cloud somehow?</p>
  
Comments: CC BY-SA 4.0
Comments: 2019-10-08T03:19:54.850Z
Comments: What type of nodes are you using and how many do you have? Services like Digital Ocean and Linode have lower cost Kubernetes offerings.
Comments: casey vega
Tags: <kubernetes><gitlab><google-cloud-platform>
Title: Cost-efficient hosting for CI/CD?
UserDisplayName: stkvtflw
ThreadText: # Cost-efficient hosting for CI/CD?
  
  (Asked by: username_0 on 2019-10-06)
  
  I'm paying over $300/month for Kubernetes to have CI/CD in GitLab. And it only covers web apps, Android apps and deployment to Google Cloud. Plus some staging environments, that do not require many resources and that I'm using rarely. It doesn't cover CD to Apple App Store though.
  
  I'm curious if there is a way to optimize this? Maybe I should buy some hardware or optimize Google Cloud somehow?
  
  **Tags:** kubernetes, gitlab, google-cloud-platform
  
  > **Comments:**
  > **username_1**: What type of nodes are you using and how many do you have? Services like Digital Ocean and Linode have lower cost Kubernetes offerings.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2019-10-10. Score: 2
  
  * Try to use only `n1-standard-1` nodes and let the autoscaler do it's magic.
  * If you can accept some downtime (and eventually some failures of the CI/CD jobs that should be fixed when you retry) you can [use preemptible nodes](https://cloud.google.com/blog/products/containers-kubernetes/cutting-costs-with-google-kubernetes-engine-using-the-cluster-autoscaler-and-preemptible-vms).
  * Migrate stateless apps to [Cloud Run](https://cloud.google.com/run/docs/quickstarts/build-and-deploy).
  * Follow [this guide](https://cloud.google.com/kubernetes-engine/docs/how-to/small-cluster-tuning) to reduce resource consumption on your cluster.
  
  
  ---
  
  ### Answer by username_3 on 2019-10-07. Score: 2
  
  Given that you mentioned rarely using some k8s resources, you could explore some alternatives:
  
  * With `gcloud SDK` you could create scripts to be executed for the periods you want to reduce GKE nodes (even to zero) during periods you're not using it
  * With [Google Cloud Functions](https://cloud.google.com/functions/docs/) (GCF) you can create some python/Node.js/Go script to access GKE APIs and also execute the operations to stop/reduce your instances. These GCF could be triggered by schedulers configured by [Cloud Scheduler](https://cloud.google.com/scheduler/docs/tut-pub-sub). The cost here for such executions will be really low or even zero.
  
  
  ---
  
  