yaml - must have shemes

  • apiVersion
  • kind
  • metadata
  • spec

apiVersion:

“apiVersion” is a yaml string


kind/version table:

Kind Version
Pod v1
Service v1
ReplicaSet apps/v1
Deployment apps/v1

kind:

“kind” is a yaml string and case sensitiv

kind can be:

  • Pod
  • Service
  • ReplicaSet
  • Deployment

metadata:

“metadata” is yaml dictionary - less attention for blank spaces

  • name
  • labels
    • app
    • tier
    • type

“labels” can be defined
“type” are pre defined properteries


spec:

“spec” is a yaml list/array

  • containers
    • name
    • image

create “pod.yml”

---
apiVersion: v1
kind: Pod
metadata:
  name: my-app
  labels:
      app: myapp
      tier: front-end

spec:
  containers:
    - name: nginx-container
      image: nginx

manage “pod.yml”

# create pod from yaml file
> kubectl create -f pod.yml

# inspect pod
> kubectl describe pod my-app

by creation > “kubectl create” and “kubectl apply” works the same