Difference between revisions of "Terraform K8s resources: kubernetes manifest"

From wikieduonline
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 9: Line 9:
 
=== Timeouts official example ===
 
=== Timeouts official example ===
  
  resource "kubernetes_manifest" "test" {
+
  {{kubernetes_manifest timeouts}}
  manifest = {
 
    // ...
 
  }
 
 
  [[wait]] {
 
    fields = {
 
      # Check the phase of a pod
 
      "status.phase" = "Running"
 
  
      # Check a container's status
 
      "status.containerStatuses[0].ready" = "true",
 
  
      # Check an ingress has an IP
 
      "status.loadBalancer.ingress[0].ip" = "^(\\d+(\\.|$)){4}"
 
 
      # Check the replica count of a Deployment
 
      "status.readyReplicas" = "2"
 
    }
 
  }
 
 
  [[timeouts]] {
 
    create = "10m"
 
    update = "10m"
 
    delete = "30s"
 
  }
 
}
 
  
  

Latest revision as of 16:51, 10 July 2024


Official example[edit]

resource "kubernetes_manifest" "test-configmap" {
 manifest = {
   "apiVersion" = "v1"
   "kind"       = "ConfigMap"
   "metadata" = {
     "name"      = "test-config"
     "namespace" = "default"
   }
   "data" = {
     "foo" = "bar"
   }
 }
}


Timeouts official example[edit]

 resource "kubernetes_manifest" "test" {
 manifest = {
   // ...
 }

 wait {
   fields = {
     # Check the phase of a pod
     "status.phase" = "Running"

     # Check a container's status
     "status.containerStatuses[0].ready" = "true",

     # Check an ingress has an IP
     "status.loadBalancer.ingress[0].ip" = "^(\\d+(\\.|$)){4}"

     # Check the replica count of a Deployment
     "status.readyReplicas" = "2"
   }
 }
 
 timeouts {
   create = "10m"
   update = "10m"
   delete = "30s"
 }
}



Terraform K8s resources: kubernetes_labels
Terraform K8s resources: kubernetes_annotations

Related[edit]

See also[edit]

Advertising: