Skip to content

Automation to deploy an Nginx Ingress Controller on the Kubernetes cluster using Ansible, Vagrant and VirtualBox.

License

Notifications You must be signed in to change notification settings

lessandro-ugulino/vagrant-k8s-ingress-nginx-automation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Setup Nginx Ingress controller on K8s - Vagrant Environment.

⚠️ This was designed only to be used on a Dev environment for education propose: Be very careful here! You can read the official documentation for more information.

Index

Requirements

These tools need to be installed on your local machine or the computer that will run Ansible:

🔨 As part of this deployment, we need to change our local host file (/etc/hosts). My host files on my MacBook is located at /etc/hosts.

Add the below entry to the file.

10.10.50.11 myapi.com

Architecture

This automation will deploy 2 Kubernetes nodes and 1 Kubernetes master as shown below.

diagram

Ingress exposes HTTP and HTTPS routes from outside the cluster to services within the cluster. Traffic routing is controlled by rules defined on the Ingress resource.

I'll deploy the Nginx Ingress to control all traffic from myapi.com/ to go to svcnginx Kubernetes services.

Arch

Deploy

Execute at the root directory:

sudo vagrant up --no-provision && sudo vagrant provision

Optional: Access Vagrant Virtual Machine

You can access the master VM executing the below command on the current folder

vagrant ssh k8s-master

This command will ssh to k8s-master VM.

Result

Once the ansible deployment finishes, you can access http://myapi.com.

ansible

Delete the env

sudo vagrant destroy -f

Output

Ingress Nginx pods

ingress-nginx-pods

Ingress Nginx rule

ingress-nginx-rule

Ingress Nginx svc

ingress-nginx-svc

Nginx Website svc

nginx-svc

About

Automation to deploy an Nginx Ingress Controller on the Kubernetes cluster using Ansible, Vagrant and VirtualBox.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published