diff --git a/examples/azure/README.md b/examples/azure/README.md new file mode 100644 index 0000000..f9833b7 --- /dev/null +++ b/examples/azure/README.md @@ -0,0 +1,9 @@ +# Azure Example + +This examples shows how to create Kubermatic project and deploy Kubernetes cluster on Azure using Terraform. + +To run, set up your Azure provider credentials. Configure Kubermatic host address. + +Running the example + +run `terraform apply` to see it work. \ No newline at end of file diff --git a/examples/azure/main.tf b/examples/azure/main.tf new file mode 100644 index 0000000..d59c662 --- /dev/null +++ b/examples/azure/main.tf @@ -0,0 +1,44 @@ +provider kubermatic { + host = "set_it_up" +} +resource "kubermatic_project" "example_project" { + name = var.project_name +} +resource "kubermatic_cluster" "example_cluster" { + name = var.cluster_name + dc_name = "azure-westeurope" + project_id = kubermatic_project.example_project.id + spec { + version = var.k8s_version + cloud { + azure { + client_id = "set_it_up" + subscription_id = "set_it_up" + tenant_id = "set_it_up" + client_secret = "set_it_up" + } + } + } +} +resource "kubermatic_node_deployment" "example_node" { + name = "examplenode" + cluster_id = kubermatic_cluster.example_cluster.id + spec { + replicas = 2 + template { + cloud { + azure { + size = "Standard_D1_v2" + } + } + operating_system { + ubuntu { + dist_upgrade_on_boot = false + } + } + versions { + kubelet = var.k8s_version + } + } + } +} \ No newline at end of file diff --git a/examples/azure/variables.tf b/examples/azure/variables.tf new file mode 100644 index 0000000..aa95d05 --- /dev/null +++ b/examples/azure/variables.tf @@ -0,0 +1,14 @@ +variable "project_name" { + description = "Name of the Kubermatic project" + default = "exampleProject" +} + +variable "cluster_name" { + description = "Name of the Kubermatic cluster" + default = "exampleCluster" +} + +variable "k8s_version" { + description = "The Kubernetes version" + default = "1.17.9" +} \ No newline at end of file diff --git a/examples/openstack/README.md b/examples/openstack/README.md new file mode 100644 index 0000000..4c7d47a --- /dev/null +++ b/examples/openstack/README.md @@ -0,0 +1,9 @@ +# OpenStack Example + +This examples shows how to create Kubermatic project and deploy Kubernetes cluster on OpenStack using Terraform. + +To run, set up your OpenStack provider credentials. Configure Kubermatic host address. + +Running the example + +run `terraform apply` to see it work. \ No newline at end of file diff --git a/examples/openstack/main.tf b/examples/openstack/main.tf new file mode 100644 index 0000000..1625098 --- /dev/null +++ b/examples/openstack/main.tf @@ -0,0 +1,46 @@ +provider kubermatic { + host = "set_it_up" +} +resource "kubermatic_project" "example_project" { + name = var.project_name +} +resource "kubermatic_cluster" "example_cluster" { + name = var.cluster_name + dc_name = "set_it_up" + project_id = kubermatic_project.example_project.id + credential = "loodse" + spec { + version = "1.17.9" + cloud { + openstack { + floating_ip_pool = "" + password = "set_it_up" + tenant = "set_it_up" + username = "set_it_up" + } + } + } +} +resource "kubermatic_node_deployment" "example_node" { + name = "examplenode" + cluster_id = kubermatic_cluster.example_cluster.id + spec { + replicas = 2 + template { + cloud { + openstack { + flavor = "l1c.tiny" + image = "kubermatic-e2e-ubuntu" + } + } + operating_system { + ubuntu { + dist_upgrade_on_boot = false + } + } + versions { + kubelet = var.k8s_version + } + } + } +} \ No newline at end of file diff --git a/examples/openstack/variables.tf b/examples/openstack/variables.tf new file mode 100644 index 0000000..aa95d05 --- /dev/null +++ b/examples/openstack/variables.tf @@ -0,0 +1,14 @@ +variable "project_name" { + description = "Name of the Kubermatic project" + default = "exampleProject" +} + +variable "cluster_name" { + description = "Name of the Kubermatic cluster" + default = "exampleCluster" +} + +variable "k8s_version" { + description = "The Kubernetes version" + default = "1.17.9" +} \ No newline at end of file