{"id":21622655,"url":"https://github.com/midoahmed/kube-cluster","last_synced_at":"2026-04-18T02:31:16.159Z","repository":{"id":121132003,"uuid":"325141790","full_name":"MidoAhmed/kube-cluster","owner":"MidoAhmed","description":"Setup demonstration of a simple Kubernetes cluster on 3 azure VMs using Ansible ","archived":false,"fork":false,"pushed_at":"2020-12-29T07:44:29.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T18:58:45.233Z","etag":null,"topics":["ansible","docker","kubeadm","kubectl","kubernetes","kubernetes-cluster","vm"],"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/MidoAhmed.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-12-28T23:50:01.000Z","updated_at":"2020-12-29T23:52:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"11723e11-f0e8-4fb8-b04f-0636278b6994","html_url":"https://github.com/MidoAhmed/kube-cluster","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MidoAhmed/kube-cluster","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MidoAhmed%2Fkube-cluster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MidoAhmed%2Fkube-cluster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MidoAhmed%2Fkube-cluster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MidoAhmed%2Fkube-cluster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MidoAhmed","download_url":"https://codeload.github.com/MidoAhmed/kube-cluster/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MidoAhmed%2Fkube-cluster/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31953758,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["ansible","docker","kubeadm","kubectl","kubernetes","kubernetes-cluster","vm"],"created_at":"2024-11-25T00:09:36.570Z","updated_at":"2026-04-18T02:31:16.148Z","avatar_url":"https://github.com/MidoAhmed.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Create Kubernetes Cluster Using Kubeadm\n - 3 nodes (1 master, 2 workers) : Ubuntu 18.04, 4GB RAM and 2 vCPUs\n - Kubernetes v1.17.0\n - Docker v19.03\n - Ansible v2.10.3\n\n## Prerequisites:\n\n- Three servers running Ubuntu 18.04 with at least 2GB RAM and 2 vCPUs each. You should be able to SSH into each server as the root user with your SSH key pair.\n        1 master and 2 workers\n- Ansible installed on your local machine.\n- git clone https://github.com/MidoAhmed/kube-cluster.git ~/kube-cluster\n\n## Steps:\n\n1. Creating a Non-Root User on All Remote Servers :\n    * execute the playbook by locally running\n    \u003e $ ansible-playbook -i ~/kube-cluster/ansible/hosts.ini ~/kube-cluster/ansible/playbooks/initial.yml\n\n2.  Installing Kubernetetes’ Dependencies\n    * execute the playbook by locally running\n    \u003e $ ansible-playbook -i ~/kube-cluster/ansible/hosts.ini ~/kube-cluster/ansible/playbooks/kube-dependencies.yml\n\n    - Installs Docker, the container runtime.\n    - Installs apt-transport-https, allowing you to add external HTTPS sources to your APT sources list.\n    - Adds the Kubernetes APT repository’s apt-key for key verification.\n    - Adds the Kubernetes APT repository to your remote servers’ APT sources list.\n    - Installs kubelet and kubeadm.\n    - Installs kubectl on your master node.\n    \n All system dependencies are now installed :)\n\n3. Setting Up the Master Node\n\n    * execute the playbook by locally running\n    \u003e $ ansible-playbook -i ~/kube-cluster/ansible/hosts.ini ~/kube-cluster/ansible/playbooks/master.yml\n\n    * Verification: Check the status of the master node\n    \u003e $ ssh ubuntu@master_ip\\\n    \u003e $ kubectl get nodes\n\nYou should see that the master in a Ready state, if it is smile ;)\n\n4. Setting Up the Worker Nodes\n\n    * execute the playbook by locally running\n    \u003e $ ansible-playbook -i ~/kube-cluster/ansible/hosts.ini ~/kube-cluster/ansible/playbooks/workers.yml\n    \nyour cluster is now fully set up and functional, with workers ready to run workloads. \n\n5. Verifying the Cluster\n    \n    * let’s verify that the cluster is working as intended.\n    \u003e $ ssh ubuntu@master_ip\\\n    \u003e $ kubectl get nodes\n\n    | NAME        | STATUS      | ROLES       | AGE     | VERSION |\n    | ----------- | ----------- | ----------- | --------|---------|\n    | instance01  | Ready       | master      | 3h4m    | v1.17.0 |\n    | instance02  | Ready       | none        | 4m26s   | v1.17.0 |\n    | instance03  | Ready       | none        | 31s     | v1.17.0 |\n\nNow that your cluster is verified successfully, \n\n## Test Access via kubectl from your machine:\n    \n    # ssh to master node and copy the following conent which is the kubeconfig for your cluster.\n    \u003e $ cat /etc/kubernetes/admin.conf or cat ~/.kube/config\n\n    # make sure that the server endpoint is accessible, if not like in example.kubeconfig file then replace it with public accessible ip\n    server: https://10.0.4.4:6443  ---\u003e server: https://master-public-ip:6443\n\n    # set kubeconfig\n    \u003e $ export KUBECONFIG=kubeconfig.yml or put in ~/.kube/config\n\n    # verifying kubectl configuration\n    \u003e $ kubectl cluster-info  --insecure-skip-tls-verify\n\n        Kubernetes master is running at https://master-public-ip:6443\n        KubeDNS is running at https://master-public-ip:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy\n\nSo congratulations you can access your kubernetes cluster \n\n## issues and troubleshooting:\n1. first issue\n    - Step: [4. Setting Up the Worker Nodes]\n    - Error: kubernetes - Couldn't able to join master node - error execution phase preflight: couldn't validate the identity of the API Server\n    - workaround: \n        - create vnet peering between master and worker 1\n        - create vnet peering between master and worker 2\n        - verify by ping between nodes, make sure that ICMP protocol is activated on each machine\n    https://docs.microsoft.com/fr-fr/azure/virtual-network/tutorial-connect-virtual-networks-portal\n## Resources:\n- https://www.digitalocean.com/community/tutorials/how-to-create-a-kubernetes-cluster-using-kubeadm-on-ubuntu-18-04#step-2-%E2%80%94-creating-a-non-root-user-on-all-remote-servers\n- https://jhooq.com/14-steps-to-install-kubernetes-on-ubuntu-18-04-and-16-04/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmidoahmed%2Fkube-cluster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmidoahmed%2Fkube-cluster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmidoahmed%2Fkube-cluster/lists"}