YAML (YAML Ain’t Markup Language) is a human-readable data serialization format, often used for configuration files, especially in tools like Kubernetes, Docker Compose, and Ansible.


🧠 YAML Concepts

  1. Key-Value Pairs
    Basic structure is key: value.
  2. Indentation Matters
    YAML uses indentation (spaces only) to define structure. No tabs allowed.
  3. Lists
    Represented with dashes -.
  4. Nested Structures
    Keys can contain maps (dictionaries) or lists.
  5. Scalars
    Basic values: strings, numbers, booleans.
  6. Comments
    Start with #.

🧱 Basic YAML Structure Example

name: MyApp
version: 1.0
enabled: true
ports:
  - 8080
  - 443
database:
  host: localhost
  port: 3306
  user: admin
  password: secret

 ※ Tistory doesn't support .yaml format


📦 Kubernetes YAML Structure Example

apiVersion: v1
kind: Pod
metadata:
  name: my-pod
  labels:
    app: demo
spec:
  containers:
    - name: my-container
      image: nginx:latest
      ports:
        - containerPort: 80

🔍 Breakdown:

  • apiVersion, kind, metadata, spec — top-level keys
  • containers — a list
  • name, image, ports — keys inside list item

Powered by. ChatGPT

'CS > Kubernetes' 카테고리의 다른 글

[Kubernetes] Scheduling(2)  (0) 2025.04.04
[Kubernetes] Scheduling(1)  (0) 2025.04.04
[Kubernetes] Service  (1) 2025.03.28
[Kubernetes] Replicaset & Deployment  (1) 2025.03.27
[Kubernetes] Kubernetes concepts  (1) 2025.03.27