{"id":15429454,"url":"https://github.com/evindunn/terraform-k8s","last_synced_at":"2025-03-28T05:26:09.281Z","repository":{"id":130611466,"uuid":"369939060","full_name":"evindunn/terraform-k8s","owner":"evindunn","description":"Kubernetes cluster using terraform, libvirt, and rke","archived":false,"fork":false,"pushed_at":"2021-11-14T19:04:26.000Z","size":59,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-02T06:25:58.158Z","etag":null,"topics":["ceph","infrastructure-as-code","kubernetes","kvm","rancher"],"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/evindunn.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":"2021-05-23T01:39:56.000Z","updated_at":"2024-06-12T02:49:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"f97acdc2-fdda-4758-9e5e-ca6a9763d5c7","html_url":"https://github.com/evindunn/terraform-k8s","commit_stats":{"total_commits":34,"total_committers":1,"mean_commits":34.0,"dds":0.0,"last_synced_commit":"a8403c2661adbfe23037187a08693255852436e0"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evindunn%2Fterraform-k8s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evindunn%2Fterraform-k8s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evindunn%2Fterraform-k8s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evindunn%2Fterraform-k8s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evindunn","download_url":"https://codeload.github.com/evindunn/terraform-k8s/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245976324,"owners_count":20703436,"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":["ceph","infrastructure-as-code","kubernetes","kvm","rancher"],"created_at":"2024-10-01T18:10:18.874Z","updated_at":"2025-03-28T05:26:09.260Z","avatar_url":"https://github.com/evindunn.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# terraform-k8s\nThree ceph nodes, three kubernetes nodes on kvm using [a yaml file](./infra.yml). The setup assumes: \n- kvm is configured and a bridge interface named 'br0' has been set up\n- the static mac addresses configured in [domains.tf](./domains.tf) have been assigned a static\nIP in dhcp\n- a public key called `terraform_rsa.pub` is available at `~/.ssh`\n- the local network is 192.168.1.0/24 with dns search domain localdomain.net\n- the k8s nodes are resolvable at k8s[0-2].localdomain.net\n- the ceph nodes are resolvable at ceph[0-2].localdomain.net\n\n## Example configuration\nSee [infra.yml](./infra.yml) for how the entire infrastructure is configured as a yaml file\n\nEach set of nodes runs a [playbook](./files) to prepare them for their respective roles.\nThe playbooks log to /var/log/ansible-prepare.log on each node. This file can be tailed until the playbook\ncompletes and the VM automatically reboots.\n\n```shell\n$ ssh ceph0 -i ~/.ssh/terraform-60bb59c0-ab3f-3eff-2ecf-230cf852348f tail -f /var/log/ansible-prepare.log\nTASK [debug] *******************************************************************\nok: [localhost] =\u003e {\n    \"msg\": \"Playbook finished on 2021-11-07 at 06:33:06 UTC\"\n}\n\nPLAY RECAP *********************************************************************\nlocalhost                  : ok=17   changed=13   unreachable=0    failed=0   \n\nConnection to ceph0 closed by remote host\n```\n\n## Ceph setup\n\nOnce the ceph playbook is complete, a new cluster can be bootstrapped by running the following in ceph0:\n1. Deploy ceph0 as the initial ceph monitor: `sudo cephadm bootstrap --ssh-user debian --mon-ip 192.168.1.50 --config ceph_initial.conf` (Replace mon-ip with ceph0's static IP)\n2. Copy the ceph public key to the remaining nodes: `for node in ceph1 ceph2; do ssh-copy-id -f -i /etc/ceph/ceph.pub debian@$node; done`\n3. Add the remaining nodes to the cluster: `for node in ceph1 ceph2; do sudo ceph orch host add $node; done`\n4. Make all of the nodes monitors: `sudo ceph orch apply mon 3`\n5. Add all availables disks on all nodes as osds: `sudo ceph orch apply osd --all-available-devices`\n6. Deploy two metadata servers for cephfs: `sudo ceph orch apply mds cephfs --placement=2`\n7. Create a cephfs filesystem for the kubernetes cluster: `sudo ceph fs volume create kubernetes`\n\n## Kubernetes Setup\n\nOnce the k8s playbooks are complete, a new kubernetes cluster can be bootstrapped by:\n1. `rke up --config rke.yml`\n2. Configure and install the [Ceph CSI driver](https://artifacthub.io/packages/helm/ceph-csi/ceph-csi-cephfs)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevindunn%2Fterraform-k8s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevindunn%2Fterraform-k8s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevindunn%2Fterraform-k8s/lists"}