728x90
- Pods는 각 컨테이너를 감싸서 1:1의 관계를 맺는다. (1:다의 관계가 될 수도 있음)
- 쿠버네티즈는 결론적으로 파드들을 관리한다.
- 즉, 가장 기본이 되는 배포 단위라고 할 수 있다.
Pod 작성을 위한 yaml 파일을 작성한다. 이미지는 도커 허브에서 끌어온다.
apiVersion: v1
kind: Pod
metadata:
name: webapp
labels:
app: webapp
release: "0"
spec:
containers:
- name: webapp
image: richardchesterwood/k8s-fleetman-webapp-angular:release0
---
apiVersion: v1
kind: Pod
metadata:
name: webapp-release-0-5
labels:
app: webapp
release: "0-5"
spec:
containers:
- name: webapp
image: richardchesterwood/k8s-fleetman-webapp-angular:release0-5
작성된 파일로 파드를 생성한다.
C:\Users\tmddn\OneDrive\바탕 화면\kubernetes>kubectl apply -f first-pod.yaml
webapp 파드를 확인, 엥귤러 파드 이벤트가 성공적으로 수행됨
C:\Users\tmddn\OneDrive\바탕 화면\kubernetes>kubectl describe pod webapp
Name: webapp
Namespace: default
Priority: 0
Service Account: default
Node: docker-desktop/192.168.65.3
Start Time: Mon, 11 Dec 2023 22:48:20 +0900
Labels: <none>
Annotations: <none>
Status: Running
IP: 10.1.0.34
IPs:
IP: 10.1.0.34
Containers:
webapp:
Container ID: docker://f98d1737842d8cdd9182572e251e5575795384a191a357a2a77e103baf13c949
Image: richardchesterwood/k8s-fleetman-webapp-angular:release0
Image ID: docker-pullable://richardchesterwood/k8s-fleetman-webapp-angular@sha256:9b98fec20772bd1d7d4c9085048f28af35b31ad3a7b7d3ba395fb512c5c359e6
Port: <none>
Host Port: <none>
State: Running
Started: Mon, 11 Dec 2023 22:48:28 +0900
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-cz7hd (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
kube-api-access-cz7hd:
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:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 2m39s default-scheduler Successfully assigned default/webapp to docker-desktop
Normal Pulling 2m38s kubelet Pulling image "richardchesterwood/k8s-fleetman-webapp-angular:release0"
Normal Pulled 2m32s kubelet Successfully pulled image "richardchesterwood/k8s-fleetman-webapp-angular:release0" in 6.608s (6.608s including waiting)
Normal Created 2m31s kubelet Created container webapp
Normal Started 2m31s kubelet Started container webapp
설치 확인
C:\Users\tmddn\OneDrive\바탕 화면\kubernetes>kubectl -it exec webapp sh
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
/ # ls
bin dev etc home lib media mnt proc root run sbin srv sys tmp usr var
/ # wget http://localhost:80
Connecting to localhost:80 (127.0.0.1:80)
index.html 100% |***********************************************************************| 585 0:00:00 ETA
/ # ls
bin etc index.html media proc run srv tmp var
dev home lib mnt root sbin sys usr
/ # cat index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Fleet Management</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.png">
</head>
<body>
<app-root></app-root>
<script type="text/javascript" src="runtime.js"></script><script type="text/javascript" src="polyfills.js"></script><script type="text/javascript" src="styles.js"></script><script type="text/javascript" src="vendor.js"></script><script type="text/javascript" src="main.js"></script></body>
</html>
/ #
https://kubernetes.io/docs/concepts/workloads/pods/
300x250
'Infra > 쿠버네티스 입문' 카테고리의 다른 글
쿠버네티스 입문 (6) - 디플로이먼트 (0) | 2023.12.13 |
---|---|
쿠버네티스 입문 (5) - 레플리카세트 (0) | 2023.12.13 |
쿠버네티스 입문 (4) - 서비스 (0) | 2023.12.12 |
쿠버네티스 입문 (2) - 환경 세팅 (1) | 2023.12.05 |
쿠버네티스 입문 (1) (1) | 2023.12.05 |