2021. 4. 4. 18:35ใ๐ฏ OpenSource/K8S
pod๋ ๋ค์๊ณผ ๊ฐ์ด ์ค์ง,์ ๊ฑฐ ํ ์ ์๋ค.
3.8.1 ์ด๋ฆ์ผ๋ก ์ญ์
pod๋ฅผ ์ญ์ ํ๋ฉด pod ์์ ๋ชจ๋ container ๋ํ ์ข ๋ฃ๋๋ค.
root@master001:~/k8s_in_action/03_pod# kubectl delete pod kubia-gpu
pod "kubia-gpu" deleted
3.8.2 Label Selector๋ฅผ ์ด์ฉํ pod ์ญ์
label์ ์ง์ ํ์ฌ ์ํ๋ ์งํฉ์ pod๋ฅผ ํ๋ฒ์ ์ญ์ ํ ์ ์๋ค.
root@master001:~/k8s_in_action/03_pod# kubectl delete pod -l creation_method=manual
pod "kubia" deleted
pod "kubia-manual-v2" deleted
3.8.3 namespace ์ญ์ ๋ก ์ธํ pod ์ ๊ฑฐ
๋ ์ด์ ์ฌ์ฉํ์ง ์๋ namespace๋ฅผ ์ง์ฐ๋ฉด ๊ทธ ์์ ์๋ ์ค๋ธ์ ํธ๋ ํจ๊ป ์ญ์ ๋๋ค.
root@master001:~/k8s_in_action/03_pod# kubectl delete ns wglee-namespace
namespace "wglee-namespace" deleted
3.8.4 namespace ์ ์งํ๋ฉด์ ๊ทธ ์์ ๋ชจ๋ pod ์ญ์
--all ์ต์ ์ผ๋ก ๊ฐํธํ๊ฒ ํด๋น namespace์ ๋ชจ๋ pod๋ฅผ ์ญ์ ํ ์ ์๋ค.
root@master001:~/k8s_in_action/03_pod# kubectl delete po --all
pod "kubia-manual" deleted
pod "kubia-manual2" deleted
pod "nginx-deployment-7d95987b64-4pk8v" deleted
pod "nginx-deployment-7d95987b64-kxr44" deleted
pod "nginx-deployment-7d95987b64-thfs6" deleted
pod "podtest" deleted
๋จ, ํด๋น ๋ช ๋ น์ด๋ฅผ ์คํ ํ ํ์๋ ๊ธฐ์กด์ replicaset ํน์ deployment๋ก ์์ฑํ ๋ฆฌ์์ค๋ ์ง์์ง์ง ์๋๋ค.
์ด ๊ฒฝ์ฐ ์์ object๋ฅผ ์ง์์ผ ๊ทธ๋ก ์ธํด ์์ฑ๋ pod๋ ์ญ์ ๊ฐ๋ฅํ๋ค.
root@master001:~/k8s_in_action/03_pod# kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx-deployment-7d95987b64-5cmxj 1/1 Running 0 97s
nginx-deployment-7d95987b64-6t5j9 1/1 Running 0 97s
nginx-deployment-7d95987b64-b9k8k 1/1 Running 0 97s
root@master001:~/k8s_in_action/03_pod# kubectl delete deployments nginx-deployment
deployment.apps "nginx-deployment" deleted
root@master001:~/k8s_in_action/03_pod# kubectl get pods
No resources found in default namespace.
3.8.5 Namespace์์ ๋ชจ๋ ๋ฆฌ์์ค ์ญ์
๋ชจ๋ ๋ฆฌ์์ค(replicaset, pod, deployment ๋ฑ)์ ํ๋ฒ์ ์ญ์ ํ ์ ์๋ค. ํ์ง๋ง secret ๋ฑ์ ๋ฆฌ์์ค๋ ์ญ์ ๋์ง ์๋ ๊ฒ์ ์ ์ํ๋ค.
root@master001:~# kubectl get pods
NAME READY STATUS RESTARTS AGE
kubia-79dbg 1/1 Running 0 17s
kubia-gpu 1/1 Running 0 72s
kubia-manual 1/1 Running 0 86s
kubia-mcllt 1/1 Running 0 17s
kubia-zg9kp 1/1 Running 0 17s
root@master001:~# kubectl get rc
NAME DESIRED CURRENT READY AGE
kubia 3 3 3 24s
root@master001:~# kubectl delete all --all
pod "kubia-79dbg" deleted
pod "kubia-gpu" deleted
pod "kubia-manual" deleted
pod "kubia-mcllt" deleted
pod "kubia-zg9kp" deleted
replicationcontroller "kubia" deleted
service "kubernetes" deleted
'๐ฏ OpenSource > K8S' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
07. ReplicaSet (0) | 2021.04.05 |
---|---|
06. liveness probe (0) | 2021.04.05 |
04. Namespace๋ฅผ ์ด์ฉํ ๋ฆฌ์์ค ๊ทธ๋ฃนํ (0) | 2021.04.04 |
03. Label์ ์ด์ฉํ Pod ๊ตฌ์ฑ (0) | 2021.04.04 |
02. YAML ๋๋ JSON ๋์คํฌ๋ฆฝํฐ๋ก Pod ์์ฑํ๊ธฐ (0) | 2021.04.03 |