Skip to content

Ansible project for the deployment of a complete bare-metal Kubernetes cluster

Notifications You must be signed in to change notification settings

ArielLahiany/kubernetes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible-Kubernetes Repository

Automate the provisioning of a new bare-metal multi-node Kubernetes cluster with Ansible. Uses all the industry-standard tools for an enterprise-grade cluster.

Table of Contents

Stack

  • Ansible: an open source IT automation engine.
  • ContainerD: an industry-standard container runtime.
  • Kubernetes: an open-source system for automating deployment, scaling, and management of containerized applications.
  • Calico: an open source networking and network security solution for containers (CNI).
  • MetalLB: a bare metal load-balancer for Kubernetes.
  • Nginx: an Ingress controller.
  • Dashboard: a web-based Kubernetes user interface.

Requirements

  1. A Linux machine with a superuser privileges and pre-installed Ansible.
  2. Ubuntu machines that are intended to become part of the new Kubernetes cluster. Make sure that your SSH key is already installed on the machines by running the following command:
$ ssh-copy-id <The remote username>@<The IPv4 address of the remote machine>

Usage

  1. Clone this Git repository to your local working station:
$ git clone https://github.com/ArielLahiany/kubernetes.git
  1. Change directory to the root directory of the project:
$ cd kubernetes
  1. Edit the values of the default variables to your requirements:
$ vim defaults/main.yaml
  1. Edit the Ansible inventory file to your requirements:
$ vim inventory/hosts.ini
  1. Edit the Ansible Vault variables file to your requirements:
$ vim vault/main.yaml
  1. Use Ansible Vault command line to encrypt the Vault variables file:
$ ansible-vault encrypt vault/main.yaml
  1. Run the Ansible Playbook:
$ ansible-playbook -i inventory/hosts.ini -K --ask-vault-pass playbooks/cluster.yaml
  1. Get the IPv4 address of the deployed Nginx ingress controller:
$ kubectl get services --all-namespaces
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
ingress-nginx ingress-nginx-controller LoadBalancer 10.96.91.254 IPv4 address 80:31478/TCP,443:31633/TCP 149m
  1. Edit the hosts file on your local working station to include the path to the dashboard:
$ sudo vim /etc/hosts
<IPv4 address of the Nginx ingress controller> <dashboard.prefix>.<cluster.domain>

For example:

192.168.14.195 dashboard.cluster.local
  1. During the deployment process the Ansible Playbook is generating a new admin token for the dashboard. Get it by running the following command:
$ cat /home/<Your username>/.kube/dashboard
  1. Browse to the address you've just added to the hosts file.
  2. Supply the created admin token in order of login into the dashboard.

About

Ansible project for the deployment of a complete bare-metal Kubernetes cluster

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages