Git Product home page Git Product logo

alvistack-ansible-collection-kubernetes's Introduction

Ansible Collection for Kubernetes

AlviStack Certified Kubernetes

Gitlab pipeline status GitHub tag GitHub license Ansible Collection

Ansible Collection for Kubernetes.

This Ansible collection provides Ansible playbooks and roles for the deployment and configuration of a Certified Kubernetes environment.

Requirements

This collection require Ansible community package 4.10 or higher.

This collection was designed for:

  • Ubuntu 20.04, 22.04, 23.04
  • CentOS 7, 8 Stream, 9 Stream
  • openSUSE Leap 15.4, Leap 15.5, Tumbleweed
  • Debian 11, 12, Testing
  • Fedora 37, 38, Rawhide
  • RHEL 7, 8, 9

Quick Start

Bootstrap Ansible and Roles

Start by cloning the repository, checkout the corresponding branch, and init with git submodule, then install Ansible (see https://software.opensuse.org/download/package?package=ansible&project=home%3Aalvistack):

# GIT checkout development branch
mkdir -p /opt/ansible-collection-kubernetes
cd /opt/ansible-collection-kubernetes
git init
git remote add upstream https://github.com/alvistack/ansible-collection-kubernetes.git
git fetch --all --prune
git checkout upstream/develop -- .
git submodule sync --recursive
git submodule update --init --recursive

# Bootstrap Ansible
echo 'deb http://downloadcontent.opensuse.org/repositories/home:/alvistack/xUbuntu_22.04/ /' | tee /etc/apt/sources.list.d/home:alvistack.list
curl -fsSL https://downloadcontent.opensuse.org/repositories/home:alvistack/xUbuntu_22.04/Release.key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/home_alvistack.gpg > /dev/null
apt update
apt install ansible

# Confirm the version of Ansible
ansible --version

AIO

All-in-one (AIO) build is a great way to perform an Kubernetes build for:

  • A development environment
  • An overview of how all the Kubernetes services fit together
  • A simple lab deployment

Simply execule our default Molecule test case and it will deploy all default components into your localhost:

# Run Molecule test case
molecule test -s default

# Confirm the version and status of Kubernetes
kubectl version --output=yaml
kubectl get node --output=yaml
kubectl get pod --all-namespaces

Production

In order to avoid Single Point of Failure, at least 3 instances for Kubernetes is recommended.

For production environment we should backed with Ceph File System for Kubernetes Persistent Volumes with ReadWriteMany support. Corresponding dynamic provisioning could be handled by using CSI CephFS.

Traditionally we could use Docker or containerd as Kubernetes container runtime (CRI). Now a day, this collection is default with the modern CRI-O implementation.

Moreover, we are using Cilium as Kubernetes network plugin (CNI) so we could support Kubernetes Network Policies.

This deployment will setup the follow components:

Start by copying the default inventory for customization:

# Copy default inventory
mkdir -p /etc/ansible
rsync -av /opt/ansible-collection-kubernetes/inventory/default/ /etc/ansible

You should update the following files as per your production environment:

  • /etc/ansible/hosts
    • Update with your inventory hostnames and IPs
  • /etc/ansible/group_vars/all/*.yml
    • Update *_release and *_version if you hope to pin the deployment into any legacy supported version

Once update now run the playbooks:

# Run playbooks
cd /opt/ansible-collection-kubernetes
ansible-playbook playbooks/converge.yml
ansible-playbook playbooks/50-kube-verify.yml
ansible-playbook playbooks/60-kube_cilium-install.yml
ansible-playbook playbooks/70-kube_csi_cephfs-install.yml
ansible-playbook playbooks/70-kube_csi_cephfs-verify.yml
ansible-playbook playbooks/80-kube_dashboard-install.yml
ansible-playbook playbooks/80-kube_ingress_nginx-install.yml
ansible-playbook playbooks/80-kube_cert_manager-install.yml

# Confirm the version and status of Kubernetes
kubectl version --output=yaml
kubectl get node --output=yaml
kubectl get pod --all-namespaces

Molecule

You could also run our Molecule test cases if you have Vagrant and Libvirt installed, e.g.

# Run Molecule on Ubuntu 22.04
molecule converge -s ubuntu-22.04

Please refer to .gitlab-ci.yml for more information on running Molecule.

Versioning

YYYYMMDD.Y.Z

Release tags could be find from GitHub Release of this repository. Thus using these tags will ensure you are running the most up to date stable version of this image.

YYYYMMDD.0.0

Version tags ended with .0.0 are rolling release rebuild by GitLab pipeline in weekly basis. Thus using these tags will ensure you are running the latest packages provided by the base image project.

License

Author Information

alvistack-ansible-collection-kubernetes's People

Contributors

hswong3i 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.