Use RKE on bare metal instead of VM

This commit is contained in:
Khue Doan 2020-11-04 22:46:38 +07:00
parent 68e15ed167
commit c2ddf906c8
3 changed files with 40 additions and 10 deletions

View File

@ -1,6 +1,38 @@
resource "openstack_images_image_v2" "centos8" { provider "rke" {
name = "CentOS_8" debug = true
image_source_url = "https://cloud.centos.org/centos/8/x86_64/images/CentOS-8-GenericCloud-8.2.2004-20200611.2.x86_64.qcow2" }
container_format = "bare"
disk_format = "qcow2" resource rke_cluster "cluster" {
nodes {
address = "192.168.1.21"
user = "root"
role = [
"controlplane",
"etcd",
"worker"
]
ssh_key = file("~/.ssh/id_rsa")
}
dynamic "nodes" {
for_each = [
"192.168.1.17",
"192.168.1.22",
"192.168.1.23"
]
content {
address = nodes.value
user = "root"
role = [
"worker",
"etcd"
]
ssh_key = file("~/.ssh/id_rsa")
}
}
}
resource "local_file" "kube_cluster_yaml" {
filename = "${path.root}/kube_config_cluster.yml"
content = rke_cluster.cluster.kube_config_yaml
} }

View File

@ -1,3 +0,0 @@
provider "openstack" {
# source admin-openrc.sh
}

View File

@ -1,7 +1,8 @@
terraform { terraform {
required_providers { required_providers {
openstack = { rke = {
source = "terraform-provider-openstack/openstack" source = "rancher/rke"
version = "1.1.3"
} }
} }
required_version = ">= 0.13" required_version = ">= 0.13"