{"id":18761174,"url":"https://github.com/jonas-be/jk8s-cluster","last_synced_at":"2025-07-04T08:36:03.813Z","repository":{"id":218580046,"uuid":"736074610","full_name":"jonas-be/jk8s-cluster","owner":"jonas-be","description":"Fully automated setup of my kubernetes cluster ","archived":false,"fork":false,"pushed_at":"2024-07-07T19:11:09.000Z","size":37,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-07T18:15:08.033Z","etag":null,"topics":["k8s","kubernetes","kubernetes-setup"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/jonas-be.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}},"created_at":"2023-12-26T23:15:54.000Z","updated_at":"2024-01-24T15:38:49.000Z","dependencies_parsed_at":"2024-01-22T22:58:05.713Z","dependency_job_id":null,"html_url":"https://github.com/jonas-be/jk8s-cluster","commit_stats":null,"previous_names":["jonas-be/jk8s-cluster"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonas-be%2Fjk8s-cluster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonas-be%2Fjk8s-cluster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonas-be%2Fjk8s-cluster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonas-be%2Fjk8s-cluster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonas-be","download_url":"https://codeload.github.com/jonas-be/jk8s-cluster/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231701607,"owners_count":18413419,"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":["k8s","kubernetes","kubernetes-setup"],"created_at":"2024-11-07T18:15:09.632Z","updated_at":"2024-12-29T04:53:16.222Z","avatar_url":"https://github.com/jonas-be.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jk8s-cluster\n\nThis repo contains scripts to setup a kubernetes cluster with 3 nodes untainted.\nIt is fully automated and installs the following:\n\n- Kubernetes (via kubeadm)\n- Cilium (CNI)\n- Traefik (Ingress)\n- Certmanager (TLS certificates)\n- Socat binary and a script (for port forwarding)\n- Longhorn (Storage)\n\n## Requirements\n\n- 3 Servers\n  - Debain 12\n  - Root access\n- Domain\n  - Be able to set DNS records\n- Local machine\n  - kubectl\n  - helm\n\n## Quickstart\n\n**First prepare your nodes:**\n\n1. Debain 12\n2. Add your ssh key to the ``authorized_keys`` file on the root\n3. Make sure all hosts are in your known hosts file\n\n**Create control plane endpoint:**\n\nCreate a sub domain for your control plane endpoint. \u003cbr\u003e\nCreate an A record for the sub domain pointing to the first node. \u003cbr\u003e\nAfter the setup you can add A records for all nodes.\n\n**Then configure the bootstrap script by setting the env vars:**\n\n```bash\n# Username and Password of the new user\nexport NEW_USER='jonasbe'\nexport PW='abc'\n\n# Control plane endpoint\nexport CP_ENDPOINT='cp.k8s.jonasbe.de:6443'\n\n# Cluster name\nexport CLUSTER_NAME='jk8s'\n\n# Email for Let's Encrypt\nexport EMAIL='jonasbe.dev@gmail.com'\n\n# Servers to setup\n# it musst be the domain to connect and the hostname of a server\n# the first server is the node which runs kubeadm init\nexport SERVERS='nc1.jonasbe.de nc2.jonasbe.de nc3.jonasbe.de'\n```\n\n**After configuring the setup, execute the script:**\n\n```bash\n./bootstrap.sh\n```\n\n## What happens?\n\n### Initialize the nodes\n\n1. Create a new user\n2. Move ssh keys to new user and remove from root\n3. Update the system\n4. Install containerd\n5. Install kubeadm, kubelet and kubectl\n\n### Initialize the cluster\n\nRuns on the first node you configured\n\n1. Create a kubeadm config file\n2. Kubeadm init with the created config file\n3. Copy the kubeconfig file to the new user\n\n### Join the other nodes\n\n1. Runs ```upload-certs``` via kubeadm\n2. Generate a join command\n3. Combines the certs from step 1 and the join command from step 2 and uses it to join the node\n\n### Install CNI\n\n1. Install cilium cli on master node\n2. Install cilium CNI command\n\n### Untatint all nodes\n\nAll nodes get untainted, so that pods can be scheduled on them.\n\n### Port forwarding\n\nTo forward ports to a node port, it uses socat.\n\nBy default it forwards port 80 and 443 to the nodeports configure in the Traefik deployment.\n\n1. Install socat and screen\n2. Start a screen session's *(you have start them after every reboot)*\n\n**How to start the forwarding manually:**\n\n```bash\n./start-forward.sh\n```\n\n### Deploy Traefik Ingress\n\n1. Install Traefik via helm\n2. Install certmanager\n3. Wait 10s to let certmanager get ready\n4. Apply letsencrypt clusterissuer, for tls certificates\n\n### Deploy Longhorn\n\n1. Prepare the nodes for longhorn\n2. Install longhorn via helm\n\n## Deployments\n\n### Test Deployment with Ingress and SSL\n\nEdit the ``traefik/whoami/whoami.yaml``  file and change the domain to your domain.\nMake sure the domain is pointing to all of your servers.\nThen apply the manifest ``kubectl apply -f traefik/whoami/whoami.yaml``.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonas-be%2Fjk8s-cluster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonas-be%2Fjk8s-cluster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonas-be%2Fjk8s-cluster/lists"}