{"id":15178830,"url":"https://github.com/lorenzofelletti/tf-kind","last_synced_at":"2026-02-28T02:42:57.341Z","repository":{"id":249960289,"uuid":"832285410","full_name":"lorenzofelletti/tf-kind","owner":"lorenzofelletti","description":"Overly convoluted way to spin up a local cluster with some observability and Velero installed","archived":false,"fork":false,"pushed_at":"2024-12-11T16:29:09.000Z","size":98,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-23T19:24:10.838Z","etag":null,"topics":["docker-compose","grafana","kind","kubernetes","prometheus","terraform","velero","velero-kubernetes"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lorenzofelletti.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-22T17:47:18.000Z","updated_at":"2024-12-11T16:29:13.000Z","dependencies_parsed_at":"2024-07-24T11:28:35.759Z","dependency_job_id":"6e83322a-a7c9-4433-a34c-07b6cd41ca0b","html_url":"https://github.com/lorenzofelletti/tf-kind","commit_stats":{"total_commits":29,"total_committers":1,"mean_commits":29.0,"dds":0.0,"last_synced_commit":"8689abb40a0d8a81dd01c57c3fab205daae9773e"},"previous_names":["lorenzofelletti/tf-kind"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lorenzofelletti/tf-kind","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lorenzofelletti%2Ftf-kind","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lorenzofelletti%2Ftf-kind/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lorenzofelletti%2Ftf-kind/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lorenzofelletti%2Ftf-kind/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lorenzofelletti","download_url":"https://codeload.github.com/lorenzofelletti/tf-kind/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lorenzofelletti%2Ftf-kind/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29923423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T19:37:42.220Z","status":"online","status_checked_at":"2026-02-28T02:00:07.010Z","response_time":90,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker-compose","grafana","kind","kubernetes","prometheus","terraform","velero","velero-kubernetes"],"created_at":"2024-09-27T15:23:25.354Z","updated_at":"2026-02-28T02:42:57.293Z","avatar_url":"https://github.com/lorenzofelletti.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Local Kubernetes cluster with Prometheus, Grafana, and More\n\u003e The most convoluted, and over-engineered way to spin up a local Kubernetes cluster.\n\n\u003e tl;dr: Run `make yolo-buildout`, `export KUBECONFIG=~/.kube/kind-config`, and explore the cluster.\n\nSpin up a Kubernetes cluster with Prometheus, Grafana, and Velero installed using Docker, and Terraform.\nThe repo provides IaC to create a Kubernetes cluster using Kind, but the Prometheus and Grafana setup can be used with any Kubernetes cluster. The Velero setup is mildly coupled with the Kind cluster, so it is not that portable.\n\n## Setup MinIO\nRun the following command to start MinIO:\n```bash\nmake minio-up\n```\n\u003e If you want to customise the MinIO setup, create a `.env` file in the `minio` directory using the `default.env` file as a template.\n\u003e\n\u003e The `default.env` file provides default values good enough for local development.\n\n## Setup Terraform State Backend on MinIO\n1. Connect to the MinIO web interface and create a bucket named `terraform-states` with\n    - Locking enabled\n    - Versioning enabled.\n\n2. Create a user with the necessary permissions to read/write to the buckets (choose the IAM setup that suits your needs best). ([example here](#Example-IAM-Setup))\n\n3. Create a pair of keys for the user, take note of them and download the `credentials.json` file. Then copy the credentials file\nto the root of this repository.\n\n1. `tpl-config.s3.tfbackend` file contains the template that will be used for the S3 backend configuration of each stack. The default configuration\nis the one tested and working with the codebase. If you want your stacks to use a different configuration, you can edit it. The template configuration\nis used by make to generate the actual configuration for each stack before `init` is run (see the `Makefile` for more details).\n\n## Create Cluster\nThe cluster IaC is in the `terraform/kind-cluster` directory.\nA `dev.tfvars` file is provided to set up a cluster using a pre-packaged configuration.\n\nRun the following command to create the cluster:\n```bash\n# file path is relative to the terraform/kind-cluster directory\nmake init STACK=kind ARGS=\"-backend-config=config.s3.tfbackend\"\nmake plan STACK=kind ARGS=\"-var-file=dev.tfvars\"\nmake apply STACK=kind\n```\n\n### Setup Prometheus And Grafana\nOnce that the cluster is created, run the following command to set up Prometheus and Grafana:\n```bash\nmake init STACK=observability ARGS=\"-backend-config=config.s3.tfbackend\"\nmake plan STACK=observability ARGS=\"-var-file=dev.tfvars\"\nmake apply STACK=observability\n```\n\n### Setup Workloads\nOnce that the cluster is created, run the following command to set up the workloads:\n```bash\nmake init STACK=workloads ARGS=\"-backend-config=config.s3.tfbackend\"\nmake plan STACK=workloads ARGS=\"-var-file=dev.tfvars\"\nmake apply STACK=workloads\n```\n\n### Setup Velero\nOnce that the cluster is created, run the following command to set up Velero:\n```bash\nmake init STACK=velero ARGS=\"-backend-config=config.s3.tfbackend\"\nmake plan STACK=velero ARGS=\"-var-file=dev.tfvars\"\nmake apply STACK=velero\n```\n\n## Local Networking\nHow to setup local DNS resolution for local.io\n```bash\nbrew install dnsmasq\nsudo brew services start dnsmasq\n# create config directory\nmkdir -pv $(brew --prefix)/etc/\n# resolve local.io to 127.0.0.1\necho 'address=/local.io/127.0.0.1' \u003e\u003e $(brew --prefix)/etc/dnsmasq.conf\necho 'port=53' \u003e\u003e $(brew --prefix)/etc/dnsmasq.conf\n# add it to resolvers (run `sudo mkdir /etc/resolver` if it doesn't exist)\nsudo bash -c 'echo \"nameserver 127.0.0.1\" \u003e /etc/resolver/local.io'\n```\n\nAn alternative, should this not be working is to choose a different name like `internal` instead of `local.io`.\nOr, you can edit `/private/etc/hosts` adding `127.0.0.1 local.io`.\n\n---\n## Example IAM Setup\n1. Go to the MinIO console (e.g. `http://localhost:9001` if you're using the default configuration).\n2. Navigate to *Identity* \u003e *Groups* and create a group named `terraform-admins` by\n  - Clicking on the *Create Group* button\n  - Setting the group name to `terraform-admins`\n  - Clicking on the *Save* button\n3. Set the policy for the group by\n  - Clicking on the newly created group `terraform-admins`\n  - Clicking on the *Policies* tab and then clicking on the *Set Policies* button\n  - From the policies list, select `consoleAdmin`, `diagnostics` and `readwrite` policies, then click *Save*\n4. Navigate to *Identity* \u003e *Users* and create a new user by\n  - Clicking on the *Create User* button\n  - Setting the *User Name* to `terraform`, and setting the *Password* to whatever you want\n  -  Assign the `terraform-admins` group in the *Assing Group* section\n  - Clicking on the *Save* button\n5. From the *Users* page create a new pair of credentials by\n  - Clicking on the newly created user `terraform`\n  - Clicking on the *Service Accounts* tab of the user\n  - Clicking on the *Create Access Key* button\n  - Clicking on the *Create* button\n  - Taking note of the *Access Key* and *Secret Key* and downloading the `credentials.json` file\n6. Eventually, further restrict the service account permissions by\n  - Clicking on the Service Account Access Key that you want to restrict, and, for example, restrict the buckets that can be accessed by\n    applying the following change\n    ```json\n    // in the statements section of the policy\n    \"Statement\": [\n      {\n       \"Effect\": \"Allow\",\n       \"Action\": [\n        \"s3:*\"\n       ],\n       \"Resource\": [\n        // change the default \"arn:aws:s3:::*\" to the following\n        \"arn:aws:s3:::cluster-kubeconfig*\",\n        \"arn:aws:s3:::terraform-states/*\"\n       ]\n      },\n    ]\n    ```\n  - Then clicking on the *Update* button.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Florenzofelletti%2Ftf-kind","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Florenzofelletti%2Ftf-kind","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Florenzofelletti%2Ftf-kind/lists"}