본문 바로가기
DevOps/DockerKubernetes

YAML 공부하기

by 계영수 2022. 9. 4.
728x90

A YAML file is used to represent data. This case configuration data here is a quick comparison of sample data in three different formats.

XML -> JSON -> YAML

If you tacke the data in its simplest form such as key value pair. This is how you would define it in YAML - Key and Value

Array/Lists

Dictionary/Map

 

#으로 시작하면 주석문

 

쿠버네티스에서 YAML 파일은 4개의 레벨을 가진다.

# Pod-Definition.yml
apiVersion:
kind:
metadata:

spec:

▷ apiVersion: This is the version of the kubernetes API you are using to create the objects. Depending on what we are trying to create we must use the right API version. For now since we are working on Pods We will set the API version as we want.

 

The 'kind' refers to the type of object we are trying to create which in this case happens to be a POD. Some other possible values here colud be replica set or deployment or service which is what you see in the kind field in the table on the right 

 

▷ metadata is  data about the object like its name labels etc. As you can see unlike the first two where you have specified a string value, this is in the form of a dictionary.

So, everything under metadata is intended to the right a little bit and so names and labels are children of metadata. The number of spaces before the two properties name and labels doesn't matter.

But they should be the same as they are siblings.

In this case labels hase more spaces on the left than name and so it is now a child of the name property instead of sibling. ==> 잘못된 케이스

728x90

'DevOps > DockerKubernetes' 카테고리의 다른 글

kubectl 명령어  (0) 2022.09.15
Backup and Restore etcd  (0) 2022.09.15
Pod  (0) 2022.09.04
우분투 리눅스에서 도커 설치  (0) 2022.09.04
쿠버네티스 학습을 위한 실습 환경의 구축 - minikube  (0) 2022.09.04