Skip to content

Instantly share code, notes, and snippets.

@kovid-r
Created September 18, 2024 03:37
Show Gist options
  • Select an option

  • Save kovid-r/e6a4951179d8648a627237a8293d9338 to your computer and use it in GitHub Desktop.

Select an option

Save kovid-r/e6a4951179d8648a627237a8293d9338 to your computer and use it in GitHub Desktop.
Output of the `terraform show` command after applying the initial infrastructure to deploy two local nginx clusters using Kubernetes
# module.nginx_cluster_one.kubernetes_deployment.nginx:
resource "kubernetes_deployment" "nginx" {
id = "nginx-cluster-one-ns/nginx-deployment"
wait_for_rollout = true
metadata {
generation = 1
labels = {
"app" = "nginx"
}
name = "nginx-deployment"
namespace = "nginx-cluster-one-ns"
resource_version = "20184"
uid = "d1840a2a-9ccc-4722-b5e7-56cfd37927b1"
}
spec {
min_ready_seconds = 0
paused = false
progress_deadline_seconds = 600
replicas = "2"
revision_history_limit = 10
selector {
match_labels = {
"app" = "nginx"
}
}
strategy {
type = "RollingUpdate"
rolling_update {
max_surge = "25%"
max_unavailable = "25%"
}
}
template {
metadata {
generation = 0
labels = {
"app" = "nginx"
}
}
spec {
active_deadline_seconds = 0
automount_service_account_token = true
dns_policy = "ClusterFirst"
enable_service_links = true
host_ipc = false
host_network = false
host_pid = false
restart_policy = "Always"
scheduler_name = "default-scheduler"
share_process_namespace = false
termination_grace_period_seconds = 30
container {
image = "nginx:1.21.1"
image_pull_policy = "IfNotPresent"
name = "nginx"
stdin = false
stdin_once = false
termination_message_path = "/dev/termination-log"
termination_message_policy = "File"
tty = false
port {
container_port = 80
host_port = 0
protocol = "TCP"
}
resources {
limits = {
"cpu" = "250m"
"memory" = "128Mi"
}
requests = {}
}
}
}
}
}
}
# module.nginx_cluster_one.kubernetes_namespace.nginx:
resource "kubernetes_namespace" "nginx" {
id = "nginx-cluster-one-ns"
wait_for_default_service_account = false
metadata {
generation = 0
name = "nginx-cluster-one-ns"
resource_version = "20098"
uid = "8c12b9b8-997f-4421-90db-621324a87f00"
}
}
# module.nginx_cluster_one.kubernetes_service.nginx:
resource "kubernetes_service" "nginx" {
id = "nginx-cluster-one-ns/nginx-service"
status = [
{
load_balancer = [
{
ingress = []
},
]
},
]
wait_for_load_balancer = true
metadata {
generation = 0
name = "nginx-service"
namespace = "nginx-cluster-one-ns"
resource_version = "20102"
uid = "cbe309d2-3691-47b0-a312-4a06781cb611"
}
spec {
allocate_load_balancer_node_ports = true
cluster_ip = "10.109.36.68"
cluster_ips = [
"10.109.36.68",
]
health_check_node_port = 0
internal_traffic_policy = "Cluster"
ip_families = [
"IPv4",
]
ip_family_policy = "SingleStack"
publish_not_ready_addresses = false
selector = {
"app" = "nginx"
}
session_affinity = "None"
type = "ClusterIP"
port {
node_port = 0
port = 80
protocol = "TCP"
target_port = "80"
}
}
}
# module.nginx_cluster_two.kubernetes_deployment.nginx:
resource "kubernetes_deployment" "nginx" {
id = "nginx-cluster-two-ns/nginx-deployment"
wait_for_rollout = true
metadata {
generation = 1
labels = {
"app" = "nginx"
}
name = "nginx-deployment"
namespace = "nginx-cluster-two-ns"
resource_version = "20194"
uid = "6a857a08-446f-46e1-9f02-182020d49187"
}
spec {
min_ready_seconds = 0
paused = false
progress_deadline_seconds = 600
replicas = "3"
revision_history_limit = 10
selector {
match_labels = {
"app" = "nginx"
}
}
strategy {
type = "RollingUpdate"
rolling_update {
max_surge = "25%"
max_unavailable = "25%"
}
}
template {
metadata {
generation = 0
labels = {
"app" = "nginx"
}
}
spec {
active_deadline_seconds = 0
automount_service_account_token = true
dns_policy = "ClusterFirst"
enable_service_links = true
host_ipc = false
host_network = false
host_pid = false
restart_policy = "Always"
scheduler_name = "default-scheduler"
share_process_namespace = false
termination_grace_period_seconds = 30
container {
image = "nginx:1.21.1"
image_pull_policy = "IfNotPresent"
name = "nginx"
stdin = false
stdin_once = false
termination_message_path = "/dev/termination-log"
termination_message_policy = "File"
tty = false
port {
container_port = 80
host_port = 0
protocol = "TCP"
}
resources {
limits = {
"cpu" = "250m"
"memory" = "128Mi"
}
requests = {}
}
}
}
}
}
}
# module.nginx_cluster_two.kubernetes_namespace.nginx:
resource "kubernetes_namespace" "nginx" {
id = "nginx-cluster-two-ns"
wait_for_default_service_account = false
metadata {
generation = 0
name = "nginx-cluster-two-ns"
resource_version = "20103"
uid = "4aa010aa-4300-43f6-9fc3-08ec3654d25a"
}
}
# module.nginx_cluster_two.kubernetes_service.nginx:
resource "kubernetes_service" "nginx" {
id = "nginx-cluster-two-ns/nginx-service"
status = [
{
load_balancer = [
{
ingress = []
},
]
},
]
wait_for_load_balancer = true
metadata {
generation = 0
name = "nginx-service"
namespace = "nginx-cluster-two-ns"
resource_version = "20118"
uid = "83fe6892-28b8-4bbc-9dc2-cc25e03c4745"
}
spec {
allocate_load_balancer_node_ports = true
cluster_ip = "10.105.218.43"
cluster_ips = [
"10.105.218.43",
]
health_check_node_port = 0
internal_traffic_policy = "Cluster"
ip_families = [
"IPv4",
]
ip_family_policy = "SingleStack"
publish_not_ready_addresses = false
selector = {
"app" = "nginx"
}
session_affinity = "None"
type = "ClusterIP"
port {
node_port = 0
port = 80
protocol = "TCP"
target_port = "80"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment