java-tutorials/terraform/best-practices/k8s-modules/modules/SvcCustomer/main.tf

68 lines
943 B
Terraform
Raw Normal View History

2020-03-29 10:49:46 -04:00
/*
* SvcCustomer deployment resources
*/
resource "kubernetes_deployment" "SvcCustomer" {
metadata {
name = "svccustomer"
labels = {
app = "SvcCustomer"
}
}
spec {
replicas = 1
selector {
match_labels = {
app = "SvcCustomer"
}
}
template {
metadata {
labels = {
app = "SvcCustomer"
}
}
spec {
image_pull_secrets {
name = "docker-config"
}
container {
image = "inanimate/echo-server"
name = "svccustomer-httpd"
env {
name = "PORT"
value = "80"
}
}
}
}
}
}
resource "kubernetes_service" "SvcCustomer" {
metadata {
name = "svccustomer"
}
spec {
selector = {
app = "SvcCustomer"
}
session_affinity = "ClientIP"
port {
port = 80
}
//type = "LoadBalancer"
}
}