{"id":13579450,"url":"https://github.com/rpenziol/proxmox-kubernetes-bootstrap","last_synced_at":"2025-04-05T20:34:15.729Z","repository":{"id":44780851,"uuid":"326523208","full_name":"rpenziol/proxmox-kubernetes-bootstrap","owner":"rpenziol","description":"This is a collection of resources to get a Kubernetes cluster up and running in a Proxmox Virtual Environment. These tools and commands assume the user is executing in a Linux or Linux-like environment.","archived":false,"fork":false,"pushed_at":"2025-03-21T07:21:04.000Z","size":45,"stargazers_count":23,"open_issues_count":0,"forks_count":6,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-21T08:25:13.423Z","etag":null,"topics":["ansible","guide","kubernetes","kubespray","proxmox"],"latest_commit_sha":null,"homepage":"","language":"Python","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/rpenziol.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}},"created_at":"2021-01-03T23:44:22.000Z","updated_at":"2024-03-29T09:41:48.000Z","dependencies_parsed_at":"2023-01-18T08:16:01.444Z","dependency_job_id":null,"html_url":"https://github.com/rpenziol/proxmox-kubernetes-bootstrap","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/rpenziol%2Fproxmox-kubernetes-bootstrap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rpenziol%2Fproxmox-kubernetes-bootstrap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rpenziol%2Fproxmox-kubernetes-bootstrap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rpenziol%2Fproxmox-kubernetes-bootstrap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rpenziol","download_url":"https://codeload.github.com/rpenziol/proxmox-kubernetes-bootstrap/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247399888,"owners_count":20932876,"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","guide","kubernetes","kubespray","proxmox"],"created_at":"2024-08-01T15:01:39.578Z","updated_at":"2025-04-05T20:34:15.722Z","avatar_url":"https://github.com/rpenziol.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# PROXMOX KUBERNETES BOOTSTRAP\n\n## Description\nThis is a collection of resources to get a Kubernetes cluster up and running in a Proxmox Virtual Environment. These tools and commands assume the user is executing in a Linux or Linux-like environment.\n# Prerequisites\n\n* Proxmox 8 or newer server up and running\n* Install Python 3 (Comes pre-installed on most Linux distros)\n* [Generate a set of SSH keys](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key)\n* [Install Docker](https://github.com/docker/docker-install#usage)\n* [Install Ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html)\n\n    ```bash\n    # There are many ways to install Ansible. pipx is my prefered method.\n    python3 -m pip install pipx\n    pipx install --include-deps ansible\n    ```\n\n    Note: in some environments you may need to use `python` instead of `python3`\n\n# Create Kubenetes nodes\n\n## Copy the example configuration file\n\n```bash\n# From the repo's root path\ncp group_vars/example-all.yaml group_vars/all.yaml\n```\n\nFill in the `group_vars/all.yaml` with values that are appropriate for your environment.\n\n## Create Kubernetes node VM(s)\n\nBy default, `create-k8s-vm.yaml` will tag the VM with **kube_node**, **kube_control_plane**, and **etcd**\n\n* **kube_node** : Kubernetes nodes where pods will run.\n* **kube_control_plane** : Where Kubernetes control plane components (apiserver, scheduler, controller) will run.\n* **etcd**: The etcd server. You should have 3 servers for failover purpose.\n\nFor high-availability, it is recommended to have 3+ nodes with these roles.\nSee [Kubespray's documentation](https://github.com/kubernetes-sigs/kubespray/blob/v2.27.0/docs/ansible/inventory.md) for more details.\n\nTo adjust the role(s) of the VM, adjust the tags:\n\n```bash\n# worker, control plane, and etcd node\nansible-playbook create-k8s-vm.yaml -K\n\n# control plane and etcd node\nansible-playbook create-k8s-vm.yaml --extra-vars \"vm_tags=kube_control_plane,etcd\" -K\n\n# worker node\nansible-playbook create-k8s-vm.yaml --extra-vars \"vm_tags=kube_node\" -K\n\n# control plane node\nansible-playbook create-k8s-vm.yaml --extra-vars \"vm_tags=kube_control_plane\" -K\n\n# etcd node\nansible-playbook create-k8s-vm.yaml --extra-vars \"vm_tags=etcd\" -K\n```\n\n# Deploy Kubernetes via Kubespray\n\n## Copy sample inventory files\n\n```bash\nDOCKER_IMAGE=quay.io/kubespray/kubespray:v2.27.0\n\nCID=$(docker create \"${DOCKER_IMAGE}\")\ndocker cp \"${CID}:/kubespray/inventory/sample\" mycluster\ndocker rm \"${CID}\"\n```\n\nMake any desired modifications to the files in \"mycluster\"\n\n## Run deploy\n\n```bash\ndocker run --rm --name kubespray --tty --interactive \\\n    -v \"$(pwd)/mycluster:/kubespray/inventory/mycluster\" \\\n    -v \"$(pwd)/group_vars/all.yaml:/kubespray/inventory/group_vars/all.yaml\" \\\n    -v \"$(pwd)/inventories/proxmox.py:/kubespray/inventory/mycluster/proxmox.py\" \\\n    -v \"${HOME}/.ssh:/root/.ssh\" \\\n    \"${DOCKER_IMAGE}\" bash\n\n# Inside the container, run:\nchown $(whoami) ~/.ssh/config\nansible-playbook -i inventory/mycluster/proxmox.py --user=user --become --become-user=root cluster.yml\nexit\n\n# Set your SSH config permissions back\nsudo chown $(whoami) ~/.ssh/config\nsudo chown $(whoami) ~/.ssh/known_hosts\n```\n\n# kubectl\n\nInstall [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl)\n\n```\nThe Kubernetes command-line tool, kubectl, allows you to run commands against Kubernetes clusters. You can use kubectl to deploy applications, inspect and manage cluster resources, and view logs.\n```\n\n## Authorization\n\n```bash\nIP=192.0.1.2  # Controller node IP address\nssh user@${IP} 'mkdir -p \"${HOME}/.kube\" \u0026\u0026 sudo cp -f /etc/kubernetes/admin.conf \"${HOME}/.kube/config\"'\n\nmkdir -p \"${HOME}/.kube\"\nssh user@${IP} 'sudo cat \"${HOME}/.kube/config\"' \u003e \"${HOME}/.kube/config\"\nsudo chown $(id -u):$(id -g) \"${HOME}/.kube/config\"\nsed -i \"s/127.0.0.1/${IP}/g\" \"${HOME}/.kube/config\"\nchmod 400 ~/.kube/config\n\nkubectl get nodes\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frpenziol%2Fproxmox-kubernetes-bootstrap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frpenziol%2Fproxmox-kubernetes-bootstrap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frpenziol%2Fproxmox-kubernetes-bootstrap/lists"}