{"id":15759069,"url":"https://github.com/aoshimash/homelab","last_synced_at":"2026-01-11T02:43:11.575Z","repository":{"id":134284706,"uuid":"301051104","full_name":"aoshimash/homelab","owner":"aoshimash","description":"自宅kubernetesクラスタの設定","archived":false,"fork":false,"pushed_at":"2020-10-04T13:58:21.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-06T13:29:31.807Z","etag":null,"topics":["ansible-playbook","homelab"],"latest_commit_sha":null,"homepage":"","language":null,"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/aoshimash.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":"2020-10-04T05:58:47.000Z","updated_at":"2022-07-03T12:33:11.000Z","dependencies_parsed_at":"2023-08-08T18:46:56.739Z","dependency_job_id":null,"html_url":"https://github.com/aoshimash/homelab","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aoshimash%2Fhomelab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aoshimash%2Fhomelab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aoshimash%2Fhomelab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aoshimash%2Fhomelab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aoshimash","download_url":"https://codeload.github.com/aoshimash/homelab/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246443527,"owners_count":20778247,"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","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":["ansible-playbook","homelab"],"created_at":"2024-10-04T10:02:51.530Z","updated_at":"2026-01-11T02:43:11.535Z","avatar_url":"https://github.com/aoshimash.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# homelab\n\n自宅kubernetesクラスタの設定\n\n## Description\n\nRaspberry Pi 4 で kubernetes クラスタをセットアップする ansible playbook\n\n## Usage\n\n各playbookの役割\n\n- setup_nodes.yml: master, worker共通のセットアップを実行するplaybook\n- setup_master_node.yml: masetr固有の設定を実行しるplaybook\n- setup_worker_nodes.yml: workre固有の設定を実行するplaybook\n\nkubernetesクラスタを構築する場合は次の手順で作業を行う。\n\n### masetrノードのセットアップ\n\n#### 1. inventoryファイルの作成\n\ninventoryファイル (`hosts/master.yml`) を作成する。`hosts/master.yml.example` をコピーして各変数を自分の環境に合わせて変更するだけで良い。\n\n#### 2. playbookの実行\n\n```\n$ ansible-playbook setup_nodes.yml -i hosts/master.yml\n\n$ ansible-playbook setup_master_node.yml -i hosts/master.yml\n(...)\nTASK [display the result] ********************************************************************************************************************************************************************\nok: [master-1] =\u003e {\n    \"msg\": [\n        \"token: wjkuzc.0dx3khby21k0by1b\",\n        \"ca_cert_hash: 63c4e6a01f6f3ef2dff873cdd926a6b08cb52260d72c4cef9a5d9171801dec79\"\n    ]\n}\nPLAY RECAP ***********************************************************************************************************************************************************************************\nmaster-1                   : ok=7    changed=0    unreachable=0    failed=0    skipped=2    rescued=0    ignored=0\n```\n\nmasterノードのセットアップに成功すると、上記のように `token` と`ca_cert_hash` の値を取得することができる。これらの情報はworkerノードをクラスタに追加するときに必要なのでメモしておく。また、トークンの有効期限は24時間以内なのでワーカーの追加は24時間以内に行う必要がある。\n\n### workerノードのセットアップ\n\n#### 1. inventoryファイルの作成\n\ninventoryファイル (`hosts/worker.yml`) を作成する。`hosts/worker.yml.example` をコピーして各変数を自分の環境に合わせて変更するだけで良い。`token` と`ca_cert_hash` の値はmasetrノードのセットアップ時に取得したものを使う。\n\n#### 2. playbookの実行\n\n```\n$ ansible-playbook setup_nodes.yml -i hosts/worker.yml\n$ ansible-playbook setup_worker_node.yml -i hosts/worker.yml\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faoshimash%2Fhomelab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faoshimash%2Fhomelab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faoshimash%2Fhomelab/lists"}