DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations

Trending

  • Auto-Scaling Kinesis Data Streams Applications on Kubernetes
  • AWS Multi-Region Resiliency Aurora MySQL Global DB With Headless Clusters
  • 8 Data Anonymization Techniques to Safeguard User PII Data
  • How To Scan and Validate Image Uploads in Java
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Terraform vs. YAML Deployment for Kubernetes Objects

Terraform vs. YAML Deployment for Kubernetes Objects

In this post, we will look at what points to consider one we are looking for deployment in the EKS server.

Shipra Garg user avatar by
Shipra Garg
·
Oct. 02, 20 · Opinion
Like (5)
Save
Tweet
Share
5.56K Views

Join the DZone community and get the full member experience.

Join For Free

Terraform: It is a tool for creating, updating, and versioning infrastructure efficiently. It can be used with many providers to create the Infrastructure. It maintains the state of objects in a state file. Kubernetes provider is used in terraform to communicate with Kubernetes Server.

YAML Deployment: YAML stands for Yet Another Markup Language, which is easy to use, a human-readable language file. It is used with many programming languages. It is easy to create Complex Kubernetes Objects using the YAML file instead of using the command line.

Understanding the differences: If you want to create one time objects in the Kubernetes Server to deploy any microservice, Then one need to evaluate possible options for good, dynamic, seamless for different environments,  easily maintainable option. Let us see the differences between the Terraform And YAML file:

  1.  Terraform maintains the state of objects created through terraforming in a state file. This state file can be stored on file System, S3 Bucket, or some source control system. Every time terraform is run, It compares the current state of infrastructure with the state file preserved by Terraform. This way if anything was deleted/Updated manually in a cluster by someone. It will show the differences to the user if Any, And it will revert back to the desired state as maintained by Terraform code.  YAML file deployment won't show any difference in the state of Objects.
  2.  One can create dynamic resources in Terraform code, for which values can be derived from the property file. So there is no need to duplicate the code if you want to deploy the same type of resources with different values. It becomes easy to maintain code with terraforming. e.g. If you have 2 deployments of microservice with different docker images, that can be done with the same code, by having 2 Modules calling the same resource with different values. Dynamic Templating is not that easy with the Yaml file.
  3. When Creating Objects through terraforming, It will wait for the response to returned by the Kubernetes server about the state of the objects. So In case of any exception, the Execution of code will be stopped for remaining resources, And the Error message will be shown. But with the YAML deployment, you have to connect to Server and check the state of the object manually.
  4. The response returned by the Kubernetes server for any object can be used in the creation of the next Object, e.g. deploying a Service of Type Loadbalancer will return the endpoint of the created load balancer, that can be used for Route 53 Or Ingress resource. It is not possible with the YAML file.
  5. Through terraform, we can talk to multiple providers like AWS and Kubernetes at the same time. One can create new EFS in AWS and use the EFS in Kubernetes resources.

I think the above differences will help in choosing terraform over the Yaml file.

YAML Kubernetes Terraform (software) Object (computer science)

Opinions expressed by DZone contributors are their own.

Trending

  • Auto-Scaling Kinesis Data Streams Applications on Kubernetes
  • AWS Multi-Region Resiliency Aurora MySQL Global DB With Headless Clusters
  • 8 Data Anonymization Techniques to Safeguard User PII Data
  • How To Scan and Validate Image Uploads in Java

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: