자격증/CKA
[CKA] Static Pod 생성
후드리챱챱
2023. 3. 5. 14:17
반응형
Static Pod
- static pod 는 master의 api가 실행하는 pod 가 아니라 노드의 kubelet 에서 실행하는것
Startic Pod 생성하기
- Configure kubelet hosting to start pod on the node
. TASK
1) Node : hk8s-w1
2) Pod Name : web
3) image : nginx
# nginx 이미지의 web pod를 만들기 위한 yaml 파일 확인
kubectl run web --image=nginx --dry-run=client -o yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: web
name: web
spec:
containers:
- image: nginx
name: web
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}
# hk8s-w1 노드 접근
ssh hk8s-w1
sudo -i
# staticPodPath 위치 확인
cat /var/lib/kubelet/config.yaml
...
shutdownGracePeriod: 0s
shutdownGracePeriodCriticalPods: 0s
staticPodPath: /etc/kubernetes/manifests
streamingConnectionIdleTimeout: 0s
syncFrequency: 0s
volumeStatsAggPeriod: 0s
# staticPodPath 위치에 web-pod.yaml 생성
cat > web-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: web
spec:
containers:
- image: nginx
name: web
# master 에서 pod 생성 확인
exit
exit
kubectl get pods
[참고]
- 유투버 따배씨
반응형