{"id":19482527,"url":"https://github.com/git-ogawa/setup_node_for_k8s","last_synced_at":"2026-03-01T18:34:04.174Z","repository":{"id":222495450,"uuid":"756205115","full_name":"git-ogawa/setup_node_for_k8s","owner":"git-ogawa","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-14T14:18:52.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-25T17:44:43.589Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/git-ogawa.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-02-12T07:28:34.000Z","updated_at":"2024-02-12T07:30:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"5fc918b6-19e5-480e-b0d5-977e6670d4ee","html_url":"https://github.com/git-ogawa/setup_node_for_k8s","commit_stats":null,"previous_names":["git-ogawa/setup_node_for_k8s"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/git-ogawa/setup_node_for_k8s","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/git-ogawa%2Fsetup_node_for_k8s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/git-ogawa%2Fsetup_node_for_k8s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/git-ogawa%2Fsetup_node_for_k8s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/git-ogawa%2Fsetup_node_for_k8s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/git-ogawa","download_url":"https://codeload.github.com/git-ogawa/setup_node_for_k8s/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/git-ogawa%2Fsetup_node_for_k8s/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29978778,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T16:35:47.903Z","status":"ssl_error","status_checked_at":"2026-03-01T16:35:44.899Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":[],"created_at":"2024-11-10T20:10:56.772Z","updated_at":"2026-03-01T18:34:04.129Z","avatar_url":"https://github.com/git-ogawa.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"This project is to create Virtual machines for k8s cluster on AWS with ansible and terraform.\nYou can create the VMs required for https://github.com/git-ogawa/setup_kube_cluster.\n\n\n# Requirements\n\nThe following required to use the project.\n\n- ansible: Install with `pip install ansible`.\n- ansible collections:\n    - community.general: Install with `ansible-galaxy collection install community.general`.\n    - amazon.aws: Install with `ansible-galaxy collection install amazon.aws`.\n- python modules\n    - boto3 : `pip install boto3`\n- terraform: See [terraform website](https://developer.hashicorp.com/terraform/install?product_intent=terraform#Linux) for installation.\n\n\n# Prerequisite\n\n## Create Inventory\n\nSettings for the project are set in ansible inventory `inventory.yml`. Before running the playbook, Set the required variables in the inventory. The settings are dynamically applied to terraform `main.tf`.\nSee the [examples/inventory.yml](examples/inventory.yml) for the example.\n\n### AWS credentials\n\nYou need to create IAM user to create AWS resources. Generate access key and secret access key of the user and set them in inventory.yml.\n\n```yml\nall:\n  vars:\n    access_key: xxx\n    secret_key: xxx\n    region: ap-northeast-1\n```\n\nAlso set credentials in `~/.aws/config` and `~/aws/.credentials` for ansible aws module.\n```\n$ cat ~/.aws/config\n[default]\nregion = ap-northeast-1\n\n\n$ cat ~/.aws/config\n[default]\naws_access_key_id = xxx\naws_secret_access_key = xxx\n```\n\nIAM user must have an permission to create and delete EC2 resources such as `AmazonEC2FullAccess`.\n\n\n### SSH keypair\n\nYou also need to create ssh keypair in AWS to log in to instances.\nSet keypair name to `key_name`\n\n\n```yml\nall:\n  vars:\n    key_name: my-keypair-name\n```\n\n### Subnet CIDR\n\nA subnet for the project is created in the default VPC.\nSet the CIDR of the subnet to `subnet_cidr`. This range must not be overlapping with the other existing subnets.\n```yml\nall:\n  vars:\n    subnet_cidr: \"10.0.128.0/20\"\n```\n\n### VM specification\n\nSet vcpu and memory (GiB) for each VM.\nAn instance type that satisfies this condition is automatically selected for the instances.\n\n```yml\nall:\n  vars:\n    memory: 4 # This means 4 GIb\n    vcpu: 2\n```\n\n### Nodes for control plane and worker\n\nYou can set hostname and OS of the nodes for control plane and worker.\nIf you want to create more than one node, add more node definitions in the same way.\nIn the following example, three instances will be created: one for control-plane and two for worker nodes.\n```yml\n  control_plane:\n      - hostname: master-1\n        os: ubuntu-22.04-amd64\n    workers:\n      - hostname: worker-1\n        os: ubuntu-23.04-amd64\n      - hostname: worker-2\n        os: rockylinux-9.2-amd64\n```\n\nThe supported OS is the following. Set variable name to `os` field.\n\n| OS | Architecture | variable name |\n| - | - | - |\n| Ubuntu 22.04 | amd64 | ubuntu-22.04-amd64 |\n| Ubuntu 23.04 | amd64 | ubuntu-23.04-amd64 |\n| Rockylinux 9.2 | amd64 | rockylinux-9.2-amd64 |\n| Rockylinux 9.3 | amd64 | rockylinux-9.3-amd64 |\n\n\n\n# Usage\n\n## Create VMs\n\nRun `create.yml` to create the resources.\n\n```\n$ ansible-playbook create.yml\n```\n\nThe playbook runs `terraform apply` to the instances and the associated resources on AWS.\n\nThe inventory `template_inventory.yml` is created after successfully finished.\nIn the inventory, the public ip address and private ip address of the created nodes are listed.\n```yml\n    control_plane:\n      hosts:\n        master-1:\n          ansible_host: 13.231.23.196\n          internal_ipv4: 172.31.140.177\n    worker:\n      hosts:\n        worker-1:\n          ansible_host: 13.230.50.154\n          internal_ipv4: 172.31.137.198\n        worker-2:\n          ansible_host: 13.114.103.197\n          internal_ipv4: 172.31.142.211\n```\n\nThis inventory can be used directly for https://github.com/git-ogawa/setup_kube_cluster.\n\n\n## Delete\n\nRun `delete.yml`.\n\n```\n$ ansible-playbook delete.yml\n```\n\nThe playback runs `terraform destroy` to remove the all resources.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgit-ogawa%2Fsetup_node_for_k8s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgit-ogawa%2Fsetup_node_for_k8s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgit-ogawa%2Fsetup_node_for_k8s/lists"}