kubectl run nginx --image=nginx:1.14.2 --dry-run=client # 명령어 검토
kubectl run nginx --image=nginx:1.14.2 --dry-run=client -o yaml # 명령에 대해 yaml로 보기
kubectl run nginx --image=nginx:1.14.2 --dry-run=client -o yaml > nginx-pod.yaml # yaml을 파일로 저장하기
Pod 실습
Info
icon
false
Pod 생성
Code Block
sansae@sansaeAir15m2 ~ % k apply -f nginx-pod.yaml
pod/nginx created
Pod 확인
Code Block
sansae@sansaeAir15m2 ~ % k get pod
NAME READY STATUS RESTARTS AGE
nginx 1/1 Running 0 86m
Pod 상세 정보 확인
Code Block
linenumbers
true
sansae@sansaeAir15m2 ~ % k describe pod nginx
Name: nginx
Namespace: default
Priority: 0
Service Account: default
Node: aks-agentpool-33019784-vmss000000/10.224.0.4
Start Time: Fri, 08 Mar 2024 14:38:30 +0900
Labels: app=myapp, type=front-end
Annotations: cni.projectcalico.org/containerID: caca6fff7130ca9b8ddc20811d6a24b2f5c4ef9acd135521e955343bb4d0c39b
cni.projectcalico.org/podIP: 10.244.0.19/32
cni.projectcalico.org/podIPs: 10.244.0.19/32
Status: Running
IP: 10.244.0.19
IPs:
IP: 10.244.0.19
Containers:
nginx:
Container ID: containerd://999b11a1c2f614dff1cd1e7a00ca9960dc09ff148faaabace98ffa038b1582f0
Image: nginx:1.14.2
Image ID: docker.io/library/nginx@sha256:f7988fb6c02e0ce69257d9bd9cf37ae20a60f1df7563c3a2a6abe24160306b8d
Port: <none>
Host Port: <none>
State: Running
Started: Fri, 08 Mar 2024 14:38:36 +0900
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-cpjv5 (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
kube-api-access-cpjv5:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
ConfigMapOptional: <nil>
DownwardAPI: true
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events: <none>
sansae@sansaeAir15m2 ~ %
Pod 삭제
Code Block
sansae@sansaeAir15m2 ~ % k delete -f nginx-pod.yaml
pod "nginx" deleted
---
sansae@sansaeAir15m2 ~ % k delete pod nginx
pod "nginx" deleted