{"id":19952993,"url":"https://github.com/dfanso/k8s-digitalocean","last_synced_at":"2026-04-12T01:39:51.691Z","repository":{"id":253518701,"uuid":"835595144","full_name":"DFanso/k8s-digitalOcean","owner":"DFanso","description":"This project sets up a Kubernetes cluster on DigitalOcean using Terraform. It provisions one master node and one worker node with specific configurations, creates a VPC, and adds the droplets to the declared project.","archived":false,"fork":false,"pushed_at":"2024-08-07T07:32:29.000Z","size":170,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-01T15:17:23.955Z","etag":null,"topics":["bash","docker","flannel","kubeadm","kubectl","kubernetes","nginx","terraform"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DFanso.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-30T06:43:45.000Z","updated_at":"2024-08-17T09:06:07.000Z","dependencies_parsed_at":"2024-08-17T11:24:21.218Z","dependency_job_id":"b94c3a8c-5820-4ab0-8bf9-171429650e18","html_url":"https://github.com/DFanso/k8s-digitalOcean","commit_stats":null,"previous_names":["dfanso/k8s-digitalocean"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DFanso/k8s-digitalOcean","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DFanso%2Fk8s-digitalOcean","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DFanso%2Fk8s-digitalOcean/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DFanso%2Fk8s-digitalOcean/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DFanso%2Fk8s-digitalOcean/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DFanso","download_url":"https://codeload.github.com/DFanso/k8s-digitalOcean/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DFanso%2Fk8s-digitalOcean/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31701641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T21:17:31.016Z","status":"ssl_error","status_checked_at":"2026-04-11T21:17:24.556Z","response_time":54,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["bash","docker","flannel","kubeadm","kubectl","kubernetes","nginx","terraform"],"created_at":"2024-11-13T01:15:00.189Z","updated_at":"2026-04-12T01:39:51.660Z","avatar_url":"https://github.com/DFanso.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Kubernetes Cluster on DigitalOcean with Terraform\n\nThis project sets up a Kubernetes cluster on DigitalOcean using Terraform. It provisions one master node and one worker node with specific configurations, creates a VPC, and adds the droplets to the declared project.\n\n## Prerequisites\n\n- [Terraform](https://www.terraform.io/downloads.html) installed on your local machine (Use terraform AMD64 binary because 386 binary have some issues)\n- A DigitalOcean account\n- A DigitalOcean API token\n- SSH key added to your DigitalOcean account\n- DigitalOcean project ID\n\n## Project Structure\n\n```\n.\n├── main.tf\n├── variables.tf\n├── outputs.tf\n├── terraform.tfvars\n└── modules\n    ├── vpc\n    │   ├── main.tf\n    │   └── variables.tf\n    └── droplet\n        ├── main.tf\n        └── variables.tf\n└── frontend\n└── backend\n└── k8s      \n```\n\n- **main.tf**: The main configuration file that sets up the provider and modules for master and worker nodes.\n- **variables.tf**: Declares the input variables used in the configuration.\n- **outputs.tf**: Defines the outputs of the configuration, specifically the IP addresses of the master and worker nodes.\n- **terraform.tfvars**: Contains the values for the variables.\n- **modules/droplet**: Contains the module for creating a DigitalOcean droplet and configuring the firewall.\n\n## Variables\n\n### `terraform.tfvars`\n\n```hcl\ndo_token = \"your_digitalocean_token\"\nmaster_name = \"k8s-master\"\nworker_name = \"k8s-worker\"\nregion = \"syd1\"\nmaster_size = \"s-2vcpu-2gb\"\nworker_size = \"s-1vcpu-1gb\"\nimage = \"ubuntu-20-04-x64\"\nssh_keys = [\"your_ssh_key_fingerprint\"]\nallowed_ports = [\n   { protocol = \"tcp\", port_range = \"22\" },\n  { protocol = \"tcp\", port_range = \"6443\" },\n  { protocol = \"tcp\", port_range = \"2379-2380\" },\n  { protocol = \"tcp\", port_range = \"6783\" },\n  { protocol = \"udp\", port_range = \"6784\" },\n  { protocol = \"tcp\", port_range = \"10248-10260\" },\n  { protocol = \"tcp\", port_range = \"80\" },\n  { protocol = \"tcp\", port_range = \"8080\" },\n  { protocol = \"tcp\", port_range = \"443\" },\n  { protocol = \"tcp\", port_range = \"30000-32767\" },\n  { protocol = \"tcp\", port_range = \"179\" },\n  { protocol = \"tcp\", port_range = \"9099\" }\n]\nproject_id = \"your_project_id\"\nvpc_name = \"k8s-vpc\"\nip_range = \"10.10.10.0/24\"\nmonitoring = true\nloadbalancer_name = \"Invabode\"\n```\n\n## Usage\n\n1. **Initialize Terraform:**\n\n   ```bash\n   terraform init\n   ```\n\n2. **Validate Terraform Code:**\n\n   ```bash\n   terraform validate\n   ```   \n\n3. **Get the list of things Terraform Going to create:**\n\n   ```bash\n   terraform plan\n   ```   \n\n\n4. **Apply the configuration:**\n\n   ```bash\n   terraform apply\n   ```\n\n   Confirm the apply step by typing `yes` when prompted. Terraform will create the resources defined in the configuration.\n\n5. **Output**:\n    After running `terraform apply`, the IP addresses of the master and worker nodes will be displayed.\n\n6. **Install necessary tolls:**:\n    - To Setup VMs for k8s, run the `common.sh` bash script on both VMs file located in `scripts`\n    - And Run the `master.sh` on the master Node and get the join command return by the script and paste it on the worker node.\n\n\u003c!-- have to change with the frontend \u0026 backend --\u003e\n7. **Run a test Applications:**:\n    - To test k8s master and worker nodes working correctly,\n      - Refer to the [Frontend Deploy README](./frontend/README.md)\n      - Refer to the [Backend Deploy README](./backend/README.md)\n\n\n## Clean Up\n\nTo destroy the resources created by this configuration, run:\n\n```sh\nterraform destroy\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdfanso%2Fk8s-digitalocean","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdfanso%2Fk8s-digitalocean","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdfanso%2Fk8s-digitalocean/lists"}