<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/lesson-5-yaml-manifests-infrastructure-as-code-ozolqq9et" -->

---
title: Lesson 5: YAML Manifests — Infrastructure as Code
description: An introductory lesson explaining how to use YAML manifests to manage Kubernetes resources declaratively instead of using imperative kubectl commands. Covers...
canonical: https://daily.dev/posts/lesson-5-yaml-manifests-infrastructure-as-code-ozolqq9et
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Lesson 5: YAML Manifests — Infrastructure as Code | daily.dev
og:description: An introductory lesson explaining how to use YAML manifests to manage Kubernetes resources declaratively instead of using imperative kubectl commands. Covers...
og:url: https://daily.dev/posts/lesson-5-yaml-manifests-infrastructure-as-code-ozolqq9et
og:image: https://api.daily.dev/og/posts/OZOlqq9ET.png
og:image:alt: Lesson 5: YAML Manifests — Infrastructure as Code
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Lesson 5: YAML Manifests — Infrastructure as Code

**[Medium](https://daily.dev/sources/medium_js)** · 5 min read · 1 upvotes · 2 comments

## Summary

An introductory lesson explaining how to use YAML manifests to manage Kubernetes resources declaratively instead of using imperative kubectl commands. Covers the four core fields of every Kubernetes manifest (apiVersion, kind, metadata, spec), walks through creating a Deployment YAML file, and explains the difference between kubectl create and kubectl apply. Includes a hands-on mini challenge to apply, update, and delete a Deployment using YAML.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://medium.com/@kunalparkhade/lesson-5-yaml-manifests-infrastructure-as-code-76c6b65e2028>

## Questions this post answers

### What is the difference between kubectl create and kubectl apply in Kubernetes?

kubectl create only works if the object does not already exist and errors out with 'already exists' on a second run, while kubectl apply creates the object if it is missing or updates it if it already exists. Because of this, apply is the standard command used in Kubernetes workflows for managing resources defined in YAML manifests.

_Developers standardizing their Kubernetes workflow can find deployment guides like this via daily.dev._

### What are the four required top-level fields in a Kubernetes YAML manifest?

Every Kubernetes manifest typically starts with apiVersion, kind, metadata, and spec. apiVersion specifies which API group and version to use, kind specifies the resource type such as Deployment or Pod, metadata holds identifying information like the resource name, and spec defines the desired state, such as the number of replicas.

_Learners building Kubernetes fundamentals can track structured lessons like this through daily.dev._

## Community discussion

Top comments from developers on daily.dev.

**@ckphirakbot** · 0 upvotes

> ![GIF](https://static.klipy.com/ii/da290b156d64898341638f3c299e7478/e7/a3/i2aN8Fz9.gif)

## Similar posts on daily.dev

- [A Beginner's Guide to Kubernetes](https://daily.dev/posts/a-beginner-s-guide-to-kubernetes-ucyxczyo1) · MetalBear · 0 upvotes · 0 comments
- [Kubernetes for developers: a complete beginner's guide](https://daily.dev/posts/kubernetes-for-developers-a-complete-beginner-s-guide-e5m8idnmp) · Flavio Copes · 2 upvotes · 0 comments
- [YAML: The Language That Quietly Runs Modern DevOps](https://daily.dev/posts/yaml-the-language-that-quietly-runs-modern-devops-ojznade2q) · Medium · 1 upvotes · 0 comments
- [Cloud native application challenges: installing the walking skeleton](https://daily.dev/posts/cloud-native-application-challenges-installing-the-walking-skeleton-ew7cvjwvj) · The New Stack · 1 upvotes · 0 comments
- [Musicians play their instruments. I play the orchestra.](https://daily.dev/posts/musicians-play-their-instruments-i-play-the-orchestra--xluq98d6s) · Medium · 3 upvotes · 0 comments

---

Tags: [#kubernetes](https://daily.dev/tags/kubernetes), [#iac](https://daily.dev/tags/iac)

[View this post on daily.dev](https://daily.dev/posts/lesson-5-yaml-manifests-infrastructure-as-code-ozolqq9et)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Lesson 5: YAML Manifests — Infrastructure as Code","url":"https://daily.dev/posts/lesson-5-yaml-manifests-infrastructure-as-code-ozolqq9et","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/lesson-5-yaml-manifests-infrastructure-as-code-ozolqq9et"},"datePublished":"2026-07-27T19:34:30.779Z","dateModified":"2026-09-14T06:38:33.182Z","description":"An introductory lesson explaining how to use YAML manifests to manage Kubernetes resources declaratively instead of using imperative kubectl commands. Covers...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/0b2b1a91f76b9b47153668ca4bb7c021?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/0b2b1a91f76b9b47153668ca4bb7c021?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Medium","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Medium","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/medium","url":"https://daily.dev/sources/medium_js"},"commentCount":2,"discussionUrl":"https://daily.dev/posts/lesson-5-yaml-manifests-infrastructure-as-code-ozolqq9et","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":2}],"keywords":"kubernetes,iac","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Medium","item":"https://daily.dev/sources/medium_js"},{"@type":"ListItem","position":3,"name":"Lesson 5: YAML Manifests — Infrastructure as Code"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/lesson-5-yaml-manifests-infrastructure-as-code-ozolqq9et","comment":[{"@type":"Comment","text":"","datePublished":"2026-07-28T01:41:26.851Z","url":"https://daily.dev/posts/OZOlqq9ET#c-xznrYddSz","author":{"@type":"Person","name":"Chhoeun K.Keaphirunphirakbot","url":"https://daily.dev/ckphirakbot","image":"https://lh3.googleusercontent.com/a/AATXAJyu3svre68RXAs8yXKtzZsd-K-S7yMa4mOqbq1m=s100"}}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/lesson-5-yaml-manifests-infrastructure-as-code-ozolqq9et#faq","mainEntity":[{"@type":"Question","name":"What is the difference between kubectl create and kubectl apply in Kubernetes?","acceptedAnswer":{"@type":"Answer","text":"kubectl create only works if the object does not already exist and errors out with 'already exists' on a second run, while kubectl apply creates the object if it is missing or updates it if it already exists. Because of this, apply is the standard command used in Kubernetes workflows for managing resources defined in YAML manifests. Developers standardizing their Kubernetes workflow can find deployment guides like this via daily.dev."}},{"@type":"Question","name":"What are the four required top-level fields in a Kubernetes YAML manifest?","acceptedAnswer":{"@type":"Answer","text":"Every Kubernetes manifest typically starts with apiVersion, kind, metadata, and spec. apiVersion specifies which API group and version to use, kind specifies the resource type such as Deployment or Pod, metadata holds identifying information like the resource name, and spec defines the desired state, such as the number of replicas. Learners building Kubernetes fundamentals can track structured lessons like this through daily.dev."}}]}
```

