Giter Site home page Giter Site logo

automate-proxmox-kubernetes's Introduction

Kubernetes Cluster Deployment on Proxmox using Terraform and Ansible

Overview

This project provides infrastructure-as-code (IaC) scripts using Terraform and Ansible to automate the deployment and installation of a Kubernetes cluster on Proxmox Virtualization Environment. The playbook deploys virtual machines (VMs) to a single host, which makes it compatible with single node environments. In a clustered environment, the VMs can then be distrbiuted manually by the user.

The Kubernetes installation includes Docker containerd.io as container runtime and Calico Operator as CNI.

Prerequisites

Before getting started, ensure you have the following prerequisites installed:

Create Proxmox API Token

pveum role add Provisioner -privs "VM.Allocate VM.Clone VM.Config.CDROM VM.Config.CPU VM.Config.Cloudinit VM.Config.Disk VM.Config.HWType VM.Config.Memory VM.Config.Network VM.Config.Options VM.Monitor VM.Audit VM.PowerMgmt Datastore.AllocateSpace Datastore.Audit"
pveum user add terraform-user@pve --password <password>
pveum aclmod / -user terraform-user@pve -role Provisioner

Configuration

  • Adjust Provider credential variables in Terraform/proxmox_credentials.auto.tfvars
  • Customize installation in Terraform/k8s_hosts_vars.vars
  • If needed, override Ansible default variables in Ansible/vars.yml

Usage

Provision VM's:

cd Ansible
ansible-playbook -i localhost, provision_hosts.yml

Install Kubernetes (using default inventory file Ansible/k8s-hosts):

cd Ansible
ansible-playbook install_cluster.yml

Directory Structure

.
├── Ansible
│   ├── ansible.cfg
│   ├── destroy_hosts.yml
│   ├── install_cluster.yml
│   ├── provision_hosts.yml
│   ├── roles
│   │   ├── role-kubernetes-initialize-cluster
│   │   │   ├── defaults
│   │   │   │   └── main.yml
│   │   │   ├── files
│   │   │   │   └── add_kubeconfig.sh
│   │   │   ├── handlers
│   │   │   │   └── main.yml
│   │   │   ├── meta
│   │   │   │   └── main.yml
│   │   │   ├── README.md
│   │   │   └── tasks
│   │   │       ├── initialize_cluster.yml
│   │   │       └── main.yml
│   │   ├── role-kubernetes-install-cni
│   │   │   ├── defaults
│   │   │   │   └── main.yml
│   │   │   ├── meta
│   │   │   │   └── main.yml
│   │   │   ├── README.md
│   │   │   └── tasks
│   │   │       ├── install_calico.yml
│   │   │       └── main.yml
│   │   ├── role-kubernetes-install-components
│   │   │   ├── defaults
│   │   │   │   └── main.yml
│   │   │   ├── handlers
│   │   │   │   └── main.yml
│   │   │   ├── meta
│   │   │   │   └── main.yml
│   │   │   ├── README.md
│   │   │   └── tasks
│   │   │       ├── install_containered.yml
│   │   │       ├── install_docker.yml
│   │   │       ├── install_kubernetes.yml
│   │   │       └── main.yml
│   │   └── role-kubernetes-prepare-os
│   │       ├── meta
│   │       │   └── main.yml
│   │       ├── README.md
│   │       └── tasks
│   │           ├── main.yml
│   │           └── prepare_os.yml
│   └── vars.yml
├── LICENSE
├── README.md
└── Terraform
    ├── k8s_hosts_vars.tf
    ├── main.tf
    ├── provider.tf
    ├── proxmox_credentials.auto.tfvars
    └── templates
        └── k8s-hosts.tpl

Contributing

If you'd like to contribute to this project, please follow the guidelines in CONTRIBUTING.md.

License

This project is licensed under the MIT License.

Acknowledgments

  • Thanks to Lachlan for inspirational blog posts.
  • Made possible by Opslogix.

automate-proxmox-kubernetes's People

Contributors

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