Skip to content

julienym/myRancher

Repository files navigation

myRancher

Terraform for Rancher on RKE1 on Proxmox

Pre-requisites:

  • Cloudflare DNS (you could change this easily)
  • Proxmox with Ubuntu VM template
  • DHCP/DNS and LB4 (ex. HaProxy)
  • A way to encrypt your sensitive files (ex. gitcrypt, sop, etc.)

DHCP client DNS registration (dynamic or static)

image-20220601213928662

Load balancer layer4 with DNS

  1. Create a DNS entry for the rancher domain name pointing to your LB IP

    image-20220601214059987

  2. Configure your LB (ex. HAProxy)

    image-20220601214145761

image-20220601214217209

Ubuntu 18 template VM

  1. Download the cloud image on your Proxmox host

  2. Create a VM in Proxmox, delete the VM disk, and note the VM ID (ex. 106)

  3. Create a disk from the cloud image in the Proxmox storage (ex. SSD)

    qm importdisk 106 ./bionic-server-cloudimg-amd64.img SSD
    

image-20220601213445582

image-20220601213829826

Steps

  1. Fork this repository

  2. Delete .gitattributes (unless you want to use gitcrypt)

  3. Choose your backend (tfstate)

    1. Local = just delete the backend.tf

    2. Remote = configure the backend.tf (ex. AzureRM):

      terraform {
        backend "azurerm" {
          resource_group_name  = "RGNAME"
          storage_account_name = "STORAGE_ACC_NAME"
          container_name       = "CONTAINER_NAME"
          key                  = "rancher.tfstate"
          access_key = "XXXXXXXXXXXXXXXXX"
        }
      }
      
  4. Replace the variables

    1. variables/encrypted/proxmox.tfvars

      proxmox_secrets = {
        url = "https://PROXMOX_HOST:8006/api2/json",
        user = "root@pam",
        pass = "PASSWORD",
        ssh_host = "PROXMOX_HOST"
        ssh_user = "root"
      }
      
    2. variables/encrypted/rancher.tfvars

      rancher_bootstrap = "RANCHER_ADMIN_PASSWORD"
      
      cloudflare = {
        zone_id = "ZONE_ID" #Zone ID for your domain name
        ip = "1.2.3.4" #IP for your external public FQDN
        api_token = "XXXXXX" #Token created
        email = "[email protected]" #Cloudflare email account
      }
      
      acme_email = "[email protected]"
      

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages