Deploying Kubernetes resources using Terraform
There are several methods to deploy applications in Kubernetes. The default and basic method to deploy YAML specifications of Kubernetes resources is to use the Kubernetes CLI called kubectl
. For more information, read the documentation here: https://kubernetes.io/docs/reference/kubectl/.
In some situations or use cases, when Terraform is well implemented in the company, instead of using different tools or CLIs, we want to automate the deployment of the cluster and the deployment of the applications using Terraform configuration.
In addition, the use of Terraform for Kubernetes resources deployment will allow you to see a preview of the changes when you apply the workflow.
In this recipe, we learn how to deploy Kubernetes resources (using object YAML specifications) in a Kubernetes cluster using Terraform.
Let’s get started!
Getting ready
To complete this recipe, you will need to know about the Kubernetes...