Posts

Showing posts with the label terraform

how to launch pod in kubernetes using terraform ?

To launch a pod in Kubernetes using Terraform, you can use the Kubernetes provider for Terraform, which allows you to manage Kubernetes resources such as pods, services, deployments, and more. Here's an example of how you can launch a pod in Kubernetes using Terraform: First, make sure you have the Kubernetes provider for Terraform installed. You can do this by adding the following code to your Terraform configuration file: provider "kubernetes" {   config_context_cluster = "your-cluster-name" } Replace "your-cluster-name" with the name of the Kubernetes cluster you want to use. Define the pod configuration by creating a new file with the .tf extension, for example pod.tf, and add the following code: resource "kubernetes_pod" "example" {   metadata {     name = "example-pod"   }   spec {     container {       image = "nginx:latest"       name  = "example-container"     }   } } This code defines a n...