Skip to content

Commit

Permalink
Added Hello-app
Browse files Browse the repository at this point in the history
  • Loading branch information
kusumsiri committed Jul 27, 2023
1 parent 04b9ed6 commit 21b0d1e
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 1 deletion.
7 changes: 6 additions & 1 deletion 03-variables.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
variable "k8_namespace" {
description = "The Kubernetes namespace"
default = "dev2"
default = "dev"
}

variable "hello_app_name" {
description = "The hello-app name"
default = "my-hello-all"
}
64 changes: 64 additions & 0 deletions 05-hello_app.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
resource "kubernetes_deployment" "hello-app" {
metadata {
name = var.hello_app_name
namespace = var.k8_namespace
labels = {
App = var.hello_app_name
}
}

spec {
replicas = 2
selector {
match_labels = {
App = var.hello_app_name
}
}
template {
metadata {
labels = {
App = var.hello_app_name
}
}
spec {
container {
image = "registry.k8s.io/e2e-test-images/echoserver:2.3"
name = var.hello_app_name

port {
container_port = 8080
}

resources {
limits = {
cpu = "500m"
memory = "32Mi"
}
requests = {
cpu = "250m"
memory = "32Mi"
}
}
}
}
}
}
}

resource "kubernetes_service" "http-svc" {
metadata {
name = var.hello_app_name
namespace = var.k8_namespace
}
spec {
selector = {
App = var.hello_app_name
}
port {
port = 80
target_port = 8080
}

type = "ClusterIP"
}
}

0 comments on commit 21b0d1e

Please sign in to comment.