본 포스팅은 따배쿠(따라하면서 배우는 쿠버네티스)을 보고 정리한 내용입니다.
yaml 파일을 읽을 때
TopDown
방식으로 읽는 것이 아니라, 통째로 쿠버네티스가 읽어서 k8s가 문법 규격을 체크하고, 필요한 정보가 있는지를 체크
apiVersion: v1
kind: Pod
metadata:
name: mypod
namespace: orange
spec:
containers:
- image: nginx:1.14
name: nginx
ports:
- containerPort: 80
- containerPort: 443
**API Version의 오류 생기면 발생 오류**
apiVersion: apps/v1
kind: Pod
metadata:
name: mypod
namespace: orange
spec:
containers:
- image: nginx:1.14
name: nginx
ports:
- containerPort: 80
- containerPort: 443
$ kubectl create -f nginx.yaml
error: unable to recognize "nginx.yaml": no matches for kind "Pod" in version "apps/v1"
**API Version 체크 명령어**
$ kubectl explain pod
KIND: Pod
VERSION: v1