YAML 파일 작성

이유진·2023년 6월 18일
0

develop

목록 보기
3/4
post-thumbnail

상위레벨 필드(루트 레벨. 필수 필드)

# pod-definition.yml
apiVersion: v1 # pod
kind: Pod
metadata:
	name: myapp-pod
	labels:
		app: myapp
		type: front-end
spec: 
	containers # Pod안에 컨테이너가 여러개이므로
		- name: nginx-container # -: 1st 항목
			image: nginx
		- name: backend-container
			image: ...

apiVersion, kind

  • string 형태
KindapiVersion
PODv1
Servicev1
ReplicaSetapps/v1
Deploymentapps/v1

💡 명령어로 알맞은 apiVersion 찾는방법
$kubectl explain replicaset

metadata

  • dictionary 형태
  • name, labels 등을 갖는다
  • 개체에 대한 데이터
  • labels: 여러 pod가 생길 때, 이것을 기반으로 filtering 할 수 있다

spec

  • dictionary 형태
  • 사양
  • containers 아래에는 여러 container 정보가 들어갈 수 있다
  • pod는 여러 container를 가질 수 있다
profile
BackEnd Developer

0개의 댓글