Giter Site home page Giter Site logo

d3athkai / kubernetes-with-ansible Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 152 KB

Multiple Ansible Roles to setup and manage your Kubernetes Cluster

License: GNU General Public License v3.0

Jinja 100.00%
kubernetes kubernetes-cluster kubernetes-bootstrap kubernetes-upgrade ansible ansible-role ansible-playbook ansible-roles ansible-playbooks ubuntu ubuntu-focal containerd kubeadm yml yaml

kubernetes-with-ansible's Introduction

GPL-3.0
Ubuntu+
Ansible Python 3 Kubernetes

Kubernetes with Ansible

Introduction

The main goal of this repo is to help with the setup and management of your Kubernetes Cluster using Ansible.

Prerequisite

  • Ansible Server to run the role(s)
  • Master node and Workers nodes installed with Ubuntu 20 (focal)
  • Full network connectivity between the Ansible Server, Master node and Workers nodes
  • Ansible inventory file configured, example:
[k8smaster]  
master-node  
  
[k8workers]  
worker-node1  
worker-node2  
  
[k8s:children]  
k8smaster  
k8workers  

Ansible Roles

There are currently 2 roles available:

kubernetes-setup

Ansible Role to bootstrap 1 Master, multiple Worker nodes Kubernetes Cluster with kubeadm to the Kubernetes version of your choice.
Based on https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/

This will setup the Kubernetes Cluster of the following design:

  • 1 Master node, >= 1 Worker nodes
  • Create a user to manage the Kubernetes Cluster
  • Kubernetes version of your choice (eg: 1.20.5-00)
  • containerd runtime
  • Weave Net for Pod network
  • Option of configuring required ports for Master and Worker nodes with UFW
  • Option of creating an NGINX deployment after the Kubernetes Cluster is setup

Usage:

  1. Download both kubernetes-setup.yml file and kubernetes-setup directory to your Ansible server.
  2. Move kubernetes-setup directory to Ansible roles folder.
  3. Update the variables inside /roles/kubernetes-setup/defaults/main.yml accordingly.
  4. Update the hosts to multi-groups specified in the Ansible inventory file inside kubernetes-setup.yml.
  5. Install the required Ansible collection:
    ansible-galaxy install -r <path-to-dir>/roles/kubernetes-setup/requirements.yml
  6. Execute the role:
    ansible-playbook kubernetes-setup.yml

kubernetes-cluster-rolling-updates

Ansible Role to perform a rolling upgrade for multiple Master and Worker nodes Kubernetes Cluster to the Kubernetes version of your choice.
Based on https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade/

Master node(s) are updated first, then followed by Worker node(s).
Only 1 node will be down each time for updates.
Node which is currently upgrading, will be first drained, followed by the Kubernetes components updates.
This method will ensure that your deployments will not be fully affected/down (provided there are >= 2 worker nodes).

Usage:

  1. Download both kubernetes-cluster-rolling-updates.yml file and kubernetes-cluster-rolling-updates directory to your Ansible server.
  2. Move kubernetes-cluster-rolling-updates directory to Ansible roles folder.
  3. Update the variables inside /roles/kubernetes-cluster-rolling-updates/defaults/main.yml accordingly.
  4. Update the hosts to multi-groups specified in the Ansible inventory file inside kubernetes-cluster-rolling-updates.yml.
  5. Execute the role: ansible-playbook kubernetes-cluster-rolling-updates.yml

kubernetes-with-ansible's People

Contributors

d3athkai avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.