๐Ÿ˜‡์ฟ ๋ฒ„๋„คํ‹ฐ์Šค POD [์ •์˜, ๋””์Šคํฌ๋ฆฝํ„ฐ, ๋ช…๋ น์–ด]

๊น€์„ฑ์ธยท2023๋…„ 10์›” 11์ผ
0

[DevOps] ๐ŸณDocker & Kubernetes

๋ชฉ๋ก ๋ณด๊ธฐ
16/62

์ฟ ๋ฒ„๋„คํ‹ฐ์Šค ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ์ตœ์†Œ ๋‹จ์œ„

ํฌ๋“œ๋Š” ํ•˜๋‚˜์˜ ๋…ธ๋“œ์•ˆ์—์„œ ์‹คํ–‰๋œ๋‹ค
ํฌ๋“œ์•ˆ์— ๋‹ค์ˆ˜์˜ ์ปจํ…Œ์ด๋„ˆ ํฌํ•จ๋˜์–ด ์‹คํ–‰๊ฐ€๋Šฅ.


ํฌ๋“œ ์ •์˜

  • apiVersion : ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค api ๋ฒ„์ „
  • kind : ๋ฆฌ์†Œ์Šค ์œ ํ˜• (ํฌ๋“œ ๋ ˆํ”Œ๋ฆฌ์นด ์ปจํŠธ๋กค๋Ÿฌ, ์„œ๋น„์Šค, ..)
  • ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ: ํฌ๋“œ์™€ ๊ด€๋ จ๋œ ์ด๋ฆ„, ๋„ค์ž„ ์ŠคํŽ˜์ด์Šค, ๋ผ๋ฒจ, ...
  • ์ŠคํŽ™: ์ปจํ…Œ์ด๋„ˆ, ๋ณผ๋ฅจ ๋“ฑ์˜ ์ •๋ณด
  • ์ƒํƒœ: ํฌ๋“œ์˜ ์ƒํƒœ, ๊ฐ ์ปจํ…Œ์ด๋„ˆ์˜ ์„ค๋ช… ๋ฐ ์ƒํƒœ, ํฌ๋“œ ๋‚ด๋ถ€์˜ IP ์ •๋ณด ๋“ฑ..

ํฌ๋“œ ๋””์Šคํฌ๋ฆฝํ„ฐ

https://www.redhat.com/ko/topics/containers/what-is-kubernetes-pod

yaml, json ํ˜•์‹์œผ๋กœ ์ž‘์„ฑ

apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
  - name: nginx
    image: nginx:1.14.2
    ports:
    - containerPort: 80
  • kind : ์–ด๋–ค ๋ฆฌ์†Œ์Šค๋ฅผ ์˜ฌ๋ฆด์ง€
  • metadata : ๋ฆฌ์†Œ์Šค์˜ ์ •๋ณด
  • spec : ์–ด๋–ค Pod์ด ์„ธํŒ… ๋˜๋Š”์ง€๋ฅผ ์ƒ์„ธํžˆ ์ž‘์„ฑ
  • containers: ์ปจํ…Œ์ด๋„ˆ์˜ ์ •๋ณด ์ €์žฅ๋จ.

kubectl explain pods : ์ž‘์„ฑ๋ฐฉ๋ฒ•

์‹คํ–‰

kubectl create -f <ํฌ๋“œ ๋””์Šคํฌ๋ฆฝํ„ฐ.yaml>

Pod ์‹คํ–‰ ํ™•์ธ

kubectl get pod <pod name> -o wide : ์‹คํ–‰ ์ •๋ณด ํ™•์ธ
kubectl get pod <pod name> -o yaml : ์ž‘์„ฑ ์ •๋ณด ํ™•์ธ
kubectl describe pod <pod name>
kubectl get pod -w : ๋Œ€๊ธฐํ•˜๋ฉด์„œ ์ƒํƒœ ํ™•์ธ

ํฌํŠธ ํฌ์›Œ๋“œ

kubectl port-forward <pod name> 8080:8080

ํฌ๋“œ ์‚ญ์ œ

kubectl delete -f <ํฌ๋“œ ๋””์Šคํฌ๋ฆฝํ„ฐ.yaml>
kubectl delete pod <pod name>
kubectl delete pod -all

๋กœ๊ทธ ํ™•์ธ

kubectl logs http-go

์ฃผ์„ ๋‹ฌ๊ธฐ

kubectl anotate pod <ํฌ๋“œ๋„ค์ž„> key=value : 256KB๊นŒ์ง€ ์ฃผ์„ ๊ฐ€๋Šฅ

๋ช…๋ น ์ „๋‹ฌ

kubectl exec <pod name> -- curl <Pod ์ฃผ์†Œ:ํฌํŠธ>

profile
๊ฐœ๋ฐœ์ž๊ฐ€ ๊ฟˆ์ธ 25์‚ด ๋Œ€ํ•™์ƒ์ž…๋‹ˆ๋‹ค.

0๊ฐœ์˜ ๋Œ“๊ธ€