{"id":30554625,"url":"https://github.com/deviant101/k8s-azure-vm-terraform","last_synced_at":"2026-04-09T20:50:27.103Z","repository":{"id":311500188,"uuid":"1043647878","full_name":"deviant101/k8s-azure-vm-terraform","owner":"deviant101","description":"Terraform configuration to deploy Azure VMs as infrastructure foundation for Kubernetes cluster setup with automated networking and security.","archived":false,"fork":false,"pushed_at":"2025-08-24T20:18:54.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-24T23:51:00.025Z","etag":null,"topics":["azure","azure-virtual-machine","cluster-deployment","devops","iac","infrastructure-as-code","k8s","kubernetes","terraform"],"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/deviant101.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,"zenodo":null}},"created_at":"2025-08-24T10:18:21.000Z","updated_at":"2025-08-24T20:18:58.000Z","dependencies_parsed_at":"2025-08-24T23:51:04.532Z","dependency_job_id":"cf3974fd-0b88-4a5e-90b7-e565464e93c0","html_url":"https://github.com/deviant101/k8s-azure-vm-terraform","commit_stats":null,"previous_names":["deviant101/k8s-azure-vm-terraform"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/deviant101/k8s-azure-vm-terraform","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deviant101%2Fk8s-azure-vm-terraform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deviant101%2Fk8s-azure-vm-terraform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deviant101%2Fk8s-azure-vm-terraform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deviant101%2Fk8s-azure-vm-terraform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deviant101","download_url":"https://codeload.github.com/deviant101/k8s-azure-vm-terraform/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deviant101%2Fk8s-azure-vm-terraform/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272436375,"owners_count":24934747,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-28T02:00:10.768Z","response_time":74,"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":["azure","azure-virtual-machine","cluster-deployment","devops","iac","infrastructure-as-code","k8s","kubernetes","terraform"],"created_at":"2025-08-28T04:16:26.849Z","updated_at":"2026-04-09T20:50:27.064Z","avatar_url":"https://github.com/deviant101.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Azure Ubuntu VMs for Kubernetes Cluster Deployment\n\nThis Terraform configuration deploys 2 Ubuntu virtual machines on Azure as infrastructure foundation for a Kubernetes cluster setup. The VMs are configured in the same virtual network to enable easy cluster communication and management.\n\n## Features\n\n- 2 Ubuntu VMs (22.04 or 24.04 LTS) ready for Kubernetes cluster deployment\n- VMs deployed in the same virtual network for seamless cluster node communication\n- SSH access enabled with key-based authentication for secure cluster management\n- Network Security Group associated with subnet for centralized security management\n- Standard SKU public IP addresses for external access (compatible with Azure Student subscriptions)\n- Premium SSD storage for better Kubernetes performance and faster container operations\n- VM specifications suitable for master and worker node configurations\n\n## Prerequisites\n\n1. **Azure CLI** - Install and configure Azure CLI\n   ```bash\n   az login\n   ```\n\n2. **Terraform** - Install Terraform (version 1.0+)\n\n3. **SSH Key Pair** - Generate SSH key pair if you don't have one\n   ```bash\n   ssh-keygen -t rsa -b 4096 -C \"your-email@example.com\"\n   ```\n\n## Configuration\n\n1. Copy the example variables file:\n   ```bash\n   cp terraform.tfvars.example terraform.tfvars\n   ```\n\n2. Edit `terraform.tfvars` to customize your deployment:\n   - `resource_group_name`: Name for the Azure resource group\n   - `location`: Azure region (e.g., \"East US\", \"West Europe\")\n   - `prefix`: Prefix for resource names\n   - `vm_size`: VM size (Standard_B2s for testing, Standard_D2s_v3 for production Kubernetes clusters)\n   - `admin_username`: Username for VM access\n   - `ssh_public_key_path`: Path to your SSH public key file\n   - `ubuntu_version`: Choose between \"22.04\" or \"24.04\" (both support Kubernetes)\n   - `environment`: Environment tag\n\n## Deployment\n\n1. Initialize Terraform:\n   ```bash\n   terraform init\n   ```\n\n2. Review the deployment plan:\n   ```bash\n   terraform plan\n   ```\n\n3. Deploy the infrastructure:\n   ```bash\n   terraform apply\n   ```\n\n4. Confirm the deployment by typing `yes` when prompted.\n\n## Accessing VMs for Kubernetes Setup\n\nAfter deployment, you can SSH into the VMs to begin Kubernetes installation:\n\n```bash\n# VM1 (can be configured as Kubernetes master node)\nssh azureuser@\u003cVM1_PUBLIC_IP\u003e\n\n# VM2 (can be configured as Kubernetes worker node)\nssh azureuser@\u003cVM2_PUBLIC_IP\u003e\n```\n\nThe VMs can communicate with each other using their private IP addresses, which is essential for Kubernetes cluster networking.\n\n## Network Configuration\n\n- **Virtual Network**: 10.0.0.0/16\n- **Subnet**: 10.0.2.0/24 (internal)\n- **Security Group**: Associated with subnet, allows SSH (port 22) from any source\n- **Public IPs**: Standard SKU with static allocation for both VMs\n\n## VM Communication for Kubernetes\n\nBoth VMs are in the same subnet and can communicate with each other using:\n- Private IP addresses (shown in Terraform outputs) - essential for Kubernetes API server communication\n- VM names (after configuring DNS or hosts file)\n- Kubernetes networking will leverage this existing network infrastructure\n\n## Next Steps - Kubernetes Installation\n\nAfter the VMs are deployed, you can proceed with Kubernetes installation:\n\n1. **Install Container Runtime** (Docker/containerd) on both VMs\n2. **Install Kubernetes components** (kubeadm, kubelet, kubectl) on both VMs\n3. **Initialize Kubernetes cluster** on VM1 (master node)\n4. **Join VM2 to the cluster** as a worker node\n5. **Configure networking** (CNI plugin like Calico or Flannel)\n\nExample commands for each VM:\n```bash\n# Update system and install Docker\nsudo apt update \u0026\u0026 sudo apt upgrade -y\nsudo apt install -y docker.io\nsudo systemctl enable docker\n\n# Install Kubernetes components\ncurl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -\necho \"deb https://apt.kubernetes.io/ kubernetes-xenial main\" | sudo tee /etc/apt/sources.list.d/kubernetes.list\nsudo apt update\nsudo apt install -y kubeadm kubelet kubectl\n```\n\n## Cleanup\n\nTo destroy the infrastructure:\n\n```bash\nterraform destroy\n```\n\n## Cost Considerations\n\n- Standard_B2s VMs are cost-effective for testing/development Kubernetes clusters\n- For production Kubernetes clusters, consider Standard_D2s_v3 or larger for better performance\n- Premium SSD storage provides better performance for etcd and container operations\n- Consider Standard HDD for cost savings if this is a learning/development cluster\n- Standard SKU public IPs may have slightly higher cost than Basic SKU but provide better performance and reliability\n- Don't forget to destroy resources when not needed to avoid ongoing charges\n\n## Customization\n\nYou can modify the configuration by:\n- Changing VM sizes in `variables.tf`\n- Adding more VMs by duplicating the VM resources\n- Modifying network security rules\n- Adding data disks or other Azure resources\n\n## Troubleshooting\n\n1. **SSH Key Issues**: Ensure your SSH public key path is correct and the key exists\n2. **Azure Authentication**: Make sure you're logged in with `az login`\n3. **Resource Naming**: Azure resource names must be unique in some cases\n4. **Region Availability**: Some VM sizes might not be available in all regions\n5. **Azure Student Subscription**: If you get \"IPv4BasicSkuPublicIpCountLimitReached\" error, this configuration uses Standard SKU public IPs which are compatible with Azure Student subscriptions\n6. **Public IP Allocation**: Standard SKU public IPs use static allocation and provide better performance and availability zone support\n\n## Azure Student Subscription Notes\n\nThis configuration is optimized for Azure Student subscriptions and Kubernetes learning:\n- Uses Standard SKU public IPs (Basic SKU has restrictions in student subscriptions)\n- Static IP allocation ensures consistent connectivity for cluster operations\n- Cost-effective VM sizes suitable for learning Kubernetes concepts and development\n- Network configuration supports Kubernetes cluster networking requirements\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeviant101%2Fk8s-azure-vm-terraform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeviant101%2Fk8s-azure-vm-terraform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeviant101%2Fk8s-azure-vm-terraform/lists"}