Skip to content

Latest commit

 

History

History
70 lines (44 loc) · 2.49 KB

README.md

File metadata and controls

70 lines (44 loc) · 2.49 KB

Provisioning an AKS, EKS, or GKE cluster with Ansible

Ansible Lint

Requirements

Ansible 2.9+ needs to be installed in your computer to run this. Python3 as well.

python -m pip install --user ansible

Cloud Provider details

Details on the requirements to create a Kubernetes cluster on each cloud provider are described in the following sub-pages:

Note: This is work in progress.

Creating a new Kubernetes Cluster

Follow these steps to provision a Kubernetes cluster.

  1. Clone this repository: git clone https://github.com/nleiva/ansible-kubernetes.git

  2. Make your cloud provider credentials available as environment variables (export). See AKS, EKS, or GKE for more details.

export <credential>='...'
  1. Run the Playbook and wait a couple of minutes while your Kubernetes cluster is being provisioned. Define the cloud provider via the variable cloud_provider (either; aws, azure, or gcp).
ansible-playbook main.yml -v --extra-vars "cloud_provider=azure"

Integrating with Advanced Cluster Management

See ACM for details.

ansible-playbook main.yml -v --extra-vars "acm_import=true cloud_provider=aws"

Destroying a Kubernetes Cluster

Follow these steps to delete a Kubernetes cluster.

  1. Run the Playbook with the variable delete set to true.Define the cloud provider via the variable cloud_provider (either; aws, azure, or gcp).
ansible-playbook main.yml -v --extra-vars "delete=true cloud_provider=azure"

Run from an Execution Environment

You need ansible-navigator installed. Here is an example to create an AKS cluster with it.

ansible-navigator run main.yml -v --extra-vars "cloud_provider=azure"

Note: I use podman as my container engine (container-engine). You can change to another alternative in the ansible navigator config file.