4. YAML Configuration File

Introduction

  • Config File is written in YAML Format

  • Config File should be stored with the code inside SCM


3 Parts of K8 Config File

  1. Metadata

  2. Specification

  3. Status (Auto Generated & Added by K8)

    • K8 Gets Status from etcd


Template

  • The specified kind has its own metadata and spec

  • Pod has also a section of its own which contains its own configuration

Labels & Connectors

  • Metadata section contain the labels

  • Spec section contains the selectors

Connecting Deployment to Pods

  • Deployment looks which pods belong to it using labels (key value pairs)

  • The label is matched by the selector

Connecting Services to Deployments

  • Similar concept as connecting deployment to pods

Ports in Service & Pods

  • Service listens on port and forwards the request to target port which must be of a pod

Minimal Deployment File


Minimal Service File


Last updated