Remove legacy bare metal cluster

This commit is contained in:
Khue Doan 2021-04-22 01:30:13 +07:00
parent efa23b0fee
commit afe59da31e
4 changed files with 0 additions and 226 deletions

View File

@ -1,62 +0,0 @@
resource "kubernetes_ingress" "grafana_ingress" {
metadata {
name = "grafana-ingress"
namespace = helm_release.prometheus.namespace
}
spec {
rule {
host = "grafana.${local.domain}"
http {
path {
backend {
service_name = "kube-prometheus-stack-grafana"
service_port = 80
}
}
}
}
}
}
resource "kubernetes_ingress" "longhorn" {
metadata {
name = "longhorn-ingress"
namespace = helm_release.longhorn.namespace
}
spec {
rule {
host = "longhorn.${local.domain}"
http {
path {
backend {
service_name = "longhorn-frontend"
service_port = 80
}
}
}
}
}
}
resource "kubernetes_ingress" "vault_ingress" {
metadata {
name = "vault-ingress"
namespace = helm_release.vault.namespace
}
spec {
rule {
host = "vault.${local.domain}"
http {
path {
backend {
service_name = "vault"
service_port = 8200
}
}
}
}
}
}

View File

@ -1,3 +0,0 @@
locals {
domain = "khuedoan.com"
}

View File

@ -1,132 +0,0 @@
provider "rke" {
debug = true
}
provider "kubernetes" {
config_path = "${path.root}/kube_config.yaml"
}
provider "helm" {
kubernetes {
config_path = "${path.root}/kube_config.yaml"
}
}
resource rke_cluster "cluster" {
dynamic "nodes" {
for_each = [
"192.168.1.110",
"192.168.1.111",
"192.168.1.112"
]
content {
address = nodes.value
user = "root"
role = [
"controlplane",
"etcd",
"worker"
]
ssh_key = file("~/.ssh/id_rsa")
}
}
dynamic "nodes" {
for_each = [
"192.168.1.113"
]
content {
address = nodes.value
user = "root"
role = [
"worker"
]
ssh_key = file("~/.ssh/id_rsa")
}
}
ingress {
provider = "none"
}
}
resource "local_file" "kube_config_yaml" {
filename = "${path.root}/kube_config.yaml"
content = rke_cluster.cluster.kube_config_yaml
}
resource "helm_release" "metallb" {
name = "metallb"
repository = "https://charts.bitnami.com/bitnami"
chart = "metallb"
version = "1.0.1"
namespace = "metallb-system"
create_namespace = true
set {
name = "configInline"
value = <<EOT
address-pools:
- name: default
protocol: layer2
addresses:
- 192.168.1.150-192.168.1.180
EOT
}
}
resource "helm_release" "nginx" {
name = "ingress-nginx"
repository = "https://kubernetes.github.io/ingress-nginx"
chart = "ingress-nginx"
version = "3.10.1"
namespace = "ingress-nginx"
create_namespace = true
}
resource "helm_release" "cert_manager" {
name = "cert-manager"
repository = "https://charts.jetstack.io"
chart = "cert-manager"
version = "1.0.4"
namespace = "cert-manager"
create_namespace = true
set {
name = "installCRDs"
value = "true"
}
}
resource "helm_release" "prometheus" {
name = "kube-prometheus-stack"
repository = "https://prometheus-community.github.io/helm-charts"
chart = "kube-prometheus-stack"
version = "11.1.2"
namespace = "monitoring-system"
create_namespace = true
}
resource "helm_release" "longhorn" {
name = "longhorn"
repository = "https://charts.longhorn.io"
chart = "longhorn"
version = "1.0.2"
namespace = "longhorn-system"
create_namespace = true
}
resource "helm_release" "vault" {
name = "vault"
repository = "https://helm.releases.hashicorp.com"
chart = "vault"
version = "0.8.0"
namespace = "vault"
create_namespace = true
}

View File

@ -1,29 +0,0 @@
terraform {
required_version = ">= 0.13"
backend "remote" {
hostname = "app.terraform.io"
organization = "khuedoan"
workspaces {
name = "homelab"
}
}
required_providers {
rke = {
source = "rancher/rke"
version = "1.1.3"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = "1.13.3"
}
helm = {
source = "hashicorp/helm"
version = "1.3.2"
}
}
}