해결된 질문
작성
·
181
1
ResourceQuota마지막 실습 ->pod 2개를 resoure제한없이 먼저 만들고 , 나중에 ResourceQuota를 만드는 경우 저는 마지막에 1기가 짜리 pod를 만들어도 이상하게 만들어지네요 ... 강사님 바쁘신데 답을 달라는 의미는 아니고요 혹시나 이런 경험 겪으신 분 있나해서 올려봅니다. ^^
1)네임스페이스 nm-4생성 , pod-2 pod-3생성
[root@k8s-master ~]# kubectl apply -f -<<END
> apiVersion: v1
> kind: Namespace
> metadata:
> name: nm-4
> END
namespace/nm-4 created
[root@k8s-master ~]# kubectl apply -f -<<END
> apiVersion: v1
> kind: Pod
> metadata:
> name: pod-2
> namespace: nm-4
> spec:
> containers:
> - name: container
> image: kubetm/app
> END
pod/pod-2 created
[root@k8s-master ~]# kubectl apply -f -<<END
> apiVersion: v1
> kind: Pod
> metadata:
> name: pod-3
> namespace: nm-4
> spec:
> containers:
> - name: container
> image: kubetm/app
> END
2)나중에 resourceQuota 1Gi메모리 제한으로 생성
[root@k8s-master ~]# kubectl apply -f -<<END
> apiVersion: v1
> kind: ResourceQuota
> metadata:
> name: rq-1
> namespace: nm-4
> spec:
> hard:
> requests.memory: 1Gi
> limits.memory: 1Gi
> END
resourcequota/rq-1 created
3)1GI메모리로 pod생성 -> 생성이 잘됨.
[root@k8s-master ~]# kubectl apply -f -<<END
> apiVersion: v1
> kind: Pod
> metadata:
> name: pod-5
> namespace: nm-4
> spec:
> containers:
> - name: container
> image: kubetm/app
> resources:
> requests:
> memory: 1Gi
> limits:
> memory: 1Gi
> END
pod/pod-5 created
4)다시한번 resourceQuota 확인 1Gi 메모리 제한으로 만들어짐
[root@k8s-master ~]# kubectl get resourcequotas --namespace=nm-4
NAME AGE REQUEST LIMIT
rq-1 17m requests.memory: 1Gi/1Gi limits.memory: 1Gi/1Gi
5)pod-2, pod-3, pod-5(1Gi메모리) describe로상태 확인 : 이상없음
[root@k8s-master ~]# kubectl describe pod pod-5 --namespace=nm-4
Name: pod-5
Namespace: nm-4
Priority: 0
Node: node-2/10.0.2.15
Start Time: Thu, 03 Dec 2020 09:03:10 +0000
Labels: <none>
Annotations: cni.projectcalico.org/podIP: 20.104.247.32/32
Status: Running
IP: 20.104.247.32
IPs:
IP: 20.104.247.32
Containers:
container:
Container ID: docker://e54cc55d119117443794ae1a8dd732b3de54c773d6b1cb3a8348c8530cee237a
Image: kubetm/app
Image ID: docker-pullable://kubetm/app@sha256:b05f32a3c9fb95ad4e54fe23d7ba62e26a6374d1fa1a7aba2d7454f57eeddd91
Port: <none>
Host Port: <none>
State: Running
Started: Thu, 03 Dec 2020 09:03:14 +0000
Ready: True
Restart Count: 0
Limits:
memory: 1Gi
Requests:
memory: 1Gi
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-q7dfv (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
default-token-q7dfv:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-q7dfv
Optional: false
QoS Class: Burstable
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 2m10s default-scheduler Successfully assigned nm-4/pod-5 to node-2
Normal Pulling <invalid> kubelet Pulling image "kubetm/app"
Normal Pulled <invalid> kubelet Successfully pulled image "kubetm/app" in 2.983328311s
Normal Created <invalid> kubelet Created container container
Normal Started <invalid> kubelet Started container container
[root@k8s-master ~]# kubectl describe pod pod-2 --namespace=nm-4
Name: pod-2
Namespace: nm-4
Priority: 0
Node: node-1/10.0.2.15
Start Time: Tue, 01 Dec 2020 19:00:04 +0000
Labels: <none>
Annotations: cni.projectcalico.org/podIP: 20.103.119.161/32
Status: Running
IP: 20.103.119.161
IPs:
IP: 20.103.119.161
Containers:
container:
Container ID: docker://a07fdb5c6fc267f9b0735386ccbcaa6bd56efd5205bebda614555c8de9268435
Image: kubetm/app
Image ID: docker-pullable://kubetm/app@sha256:b05f32a3c9fb95ad4e54fe23d7ba62e26a6374d1fa1a7aba2d7454f57eeddd91
Port: <none>
Host Port: <none>
State: Running
Started: Tue, 01 Dec 2020 19:00:07 +0000
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-q7dfv (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
default-token-q7dfv:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-q7dfv
Optional: false
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 Pulling 20h kubelet Pulling image "kubetm/app"
Normal Pulled 20h kubelet Successfully pulled image "kubetm/app" in 3.01126576s
Normal Created 20h kubelet Created container container
Normal Started 20h kubelet Started container container
Normal Scheduled 27m default-scheduler Successfully assigned nm-4/pod-2 to node-1
[root@k8s-master ~]# kubectl describe pod pod-3 --namespace=nm-4
Name: pod-3
Namespace: nm-4
Priority: 0
Node: node-2/10.0.2.15
Start Time: Thu, 03 Dec 2020 08:39:12 +0000
Labels: <none>
Annotations: cni.projectcalico.org/podIP: 20.104.247.30/32
Status: Running
IP: 20.104.247.30
IPs:
IP: 20.104.247.30
Containers:
container:
Container ID: docker://3d7efc44f5e59d59a472aadff4c330c3ef71ec7ad51290382c8bb21018eb74da
Image: kubetm/app
Image ID: docker-pullable://kubetm/app@sha256:b05f32a3c9fb95ad4e54fe23d7ba62e26a6374d1fa1a7aba2d7454f57eeddd91
Port: <none>
Host Port: <none>
State: Running
Started: Thu, 03 Dec 2020 08:39:15 +0000
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-q7dfv (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
default-token-q7dfv:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-q7dfv
Optional: false
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 27m default-scheduler Successfully assigned nm-4/pod-3 to node-2
Normal Pulling <invalid> kubelet Pulling image "kubetm/app"
Normal Pulled <invalid> kubelet Successfully pulled image "kubetm/app" in 2.844801073s
Normal Created <invalid> kubelet Created container container
Normal Started <invalid> kubelet Started container container
6)쿠버네티스 버전은 1.19.4임
[root@k8s-master ~]# kubectl get node
NAME STATUS ROLES AGE VERSION
k8s-master Ready master 6d10h v1.19.4
node-1 Ready <none> 6d9h v1.19.4
node-2 Ready <none> 6d9h v1.19.4
답변 4
1
1
내용을 오해하신거 같네요^^
일단 내용을 봤을때 pod-5가 정상적으로 running 되어야 하는게 맞고요
제 설명도 해당 상황일때 pod-5가 정상적으로 running되는데 그러면 문제니 주의해서 써야 해야한다는 내용입니다.
실습 내용을 보면 제가 pod-5를 만들 당시에는 waiting 상태이지만 대시보드가 갱신이 되지 않아서 waiting으로 보이시는거고.
11:55초인가 쯤보면 화면을 리플리시 하게 되는데 그때 Running으로 변경되는걸 확인하실 수 있으세요.
실습을 해보실때 제가 했던 것과 다르게 동작하는 부분에 대한 질문은 언제나 환영이니 내용이 길더라도 편하게 질문해주셔 되세요.
1
강사님 제가 테스트 과정을 다 캡쳐하다보니까 글이 너무 길었죠 ~ ^^
강사님 동영상 강의 11분 5초 부분에서는 아래 3)과정의 pod-5를 생성하실때 1Gi 메모리로 설정했기 떄문에 pod-5가 waiting 상태였으나 저는 pod-5가 running상태로 생성이 잘됩니다.
그래서 이런 경험 겪으신분이 있으신가 해서 위의 질문에 테스트 과정을 한번 다 올려보았습니다.^^ 물론 쿠버네티스 버전(1.19.4)은 강사님과 다르긴 합니다. ㅎㅎ
1)네임스페이스 nm-4생성 , pod-2 pod-3생성
2)nm-4 네임스페이스에 resourceQuota 1Gi메모리 제한으로 생성 , 즉 resourceQuota를 pod를 만든 이후에 생성함.
3)1Gi메모리로 pod-5생성 -> 강사님 강의에서는 waiting 상태였으나 pod-5가 running상태로 생성이 잘됨.
0
안녕하세요!
강의 내용에 따라 실습하신 내용에 잘못된 부분이 없어 보이는데.
마지막 1기가 자리 Pod가 이상하게 만들어진다는 말씀이 어떤 내용인지 부연설명 부탁드릴께요.