https://github.com/hermanbanken/konlet-pulumi
Example of how to deploy a Konlet VM using Pulumi to GCP: run Docker directly on GCP
https://github.com/hermanbanken/konlet-pulumi
Last synced: 8 months ago
JSON representation
Example of how to deploy a Konlet VM using Pulumi to GCP: run Docker directly on GCP
- Host: GitHub
- URL: https://github.com/hermanbanken/konlet-pulumi
- Owner: hermanbanken
- License: mit
- Created: 2022-02-14T10:48:42.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-14T11:12:59.000Z (over 3 years ago)
- Last Synced: 2024-12-27T18:42:03.898Z (10 months ago)
- Language: Go
- Size: 21.5 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Konlet: cheapest way to continuously run Docker image on GCP
This Pulumi setup deploys a Docker image to GCP. It does so in the cheapest way possible: using e2-micro instances and [preemptible](https://cloud.google.com/compute/docs/instances/preemptible) instances ([60-91% discount](https://cloud.google.com/compute/docs/instances/spot#pricing)). This means you can have a running instance 24/7 for around 3$/month.The setup uses the [Konlet feature](https://github.com/GoogleCloudPlatform/konlet) of the host VM OS (cos-cloud).
### Alternatives
In principle, this is much like [running the following commands](https://cloud.google.com/compute/docs/containers/deploying-containers). However, those commands can not easily be automated. This repository provides a template for how to automate them using Pulumi.```bash
export DOCKER_IMAGE=gcr.io/cloud-marketplace/google/nginx1:15# Single instance
gcloud compute instances create-with-container VM_NAME \
--container-image $DOCKER_IMAGE# or with a MIG (https://cloud.google.com/compute/docs/containers/deploying-containers#managedinstancegroupcontainer) template
gcloud compute instance-templates create-with-container nginx-template \
--container-image $DOCKER_IMAGE
gcloud compute instance-groups managed create example-group \
--base-instance-name nginx-vm --size 1 --template nginx-template
```