Skip to main content

One post tagged with "CKAD"

View All Tags

Yaml 작성 기본 Tip

· One min read

최근 포스팅을 할 여유가 되지 않아 일단 틈틈히 준비중인 CKAD 준비하는 팁이나 정보등을 먼저 정리하고자 한다.
그중 기본이 되는 YAML을 최초 작성할때 팁을 정리해봤다.

Manifest YAML작성 Tip​

CLI안에서 Manifest YAML파일을 작성하는것은 쉽지 않다. 특히 시험중에 Copy/Paste를 하는것은 어렵고 느리게 진행될수 있으므로 CLI안에서 해결하는것이 좋다.

kubectl run 활용​

https://kubernetes.io/docs/reference/kubectl/conventions/

위 링크를 잘 기억해놓고 실제 시험을 볼때 template작성을 위해 아래와 같이 Manifest를 해보는것이 가장 좋다.

Pod Manifest YAML​

$ kubectl run --generator=run-pod/v1 nginx --image=nginx --dry-run -o yaml

Deployment YAML​

$ kubectl run --generator=deployment/v1beta1 nginx --image=nginx --dry-run --replicas=4 -o yaml

YAML로 저장​

$ kubectl run --generator=deployment/v1beta1 nginx --image=nginx --dry-run --replicas=4 -o yaml > nginx-deployment.yaml