반응형
RHOCP4 (openshift4)의 가장 최소 단위인 Pod 관리에 대해서 정리하였습니다.
본 내용도 노드 관리와 같이 지속적으로 추가 업데이트 예정입니다.
Pod 란 :
하나 이상의 컨테이너와 환경들로 구성되어 운영되는 단위를 말하며, 자체 내부 IP 주소와 Port가 할당됩니다.
1. Pod 확인
1.1 oc get pods -n openshift-multus
-> openshift-multus NS에 존재하는 Pod 목록 및 상태 확인
[root@bastion config]#oc get pods -n openshift-multus
NAME READY STATUS RESTARTS AGE
multus-6hqnq 1/1 Running 0 3h47m
multus-additional-cni-plugins-7wrcc 1/1 Running 0 3h47m
multus-additional-cni-plugins-fqckw 1/1 Running 0 4h46m
multus-additional-cni-plugins-j9msn 1/1 Running 0 4h42m
multus-additional-cni-plugins-qwq8g 1/1 Running 0 4h38m
multus-admission-controller-d8sz9 2/2 Running 0 4h45m
multus-admission-controller-gxjj9 2/2 Running 0 4h38m
multus-admission-controller-hnlhp 2/2 Running 0 4h42m
1.2 oc get pods -n openshift-multus -o wide
-> pod의 상세 내용 보기, 추가로 IP와 어느 node에 배포되었는지 확인 가능
[root@bastion config]#oc get pods -n openshift-multus -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
multus-6hqnq 1/1 Running 0 3h49m 55.55.35.216 worker1.ocp-dc.hk.com <none> <none>
multus-additional-cni-plugins-7wrcc 1/1 Running 0 3h49m 55.55.35.216 worker1.ocp-dc.hk.com <none> <none>
multus-additional-cni-plugins-fqckw 1/1 Running 0 4h47m 55.55.35.211 master1.ocp-dc.hk.com <none> <none>
multus-additional-cni-plugins-j9msn 1/1 Running 0 4h44m 55.55.35.212 master2.ocp-dc.hk.com <none> <none>
multus-additional-cni-plugins-qwq8g 1/1 Running 0 4h40m 55.55.35.213 master3.ocp-dc.hk.com <none> <none>
multus-admission-controller-d8sz9 2/2 Running 0 4h47m 10.128.0.33 master1.ocp-dc.hk.com <none> <none>
multus-admission-controller-gxjj9 2/2 Running 0 4h40m 10.130.0.10 master3.ocp-dc.hk.com <none> <none>
multus-admission-controller-hnlhp 2/2 Running 0 4h44m 10.129.0.7 master2.ocp-dc.hk.com <none> <none>
1.3 oc get pods --all-namespaces
-> 모든 namespace (project)의 pod 정보 확인 가능 (route, service등등)
[root@bastion config]#oc get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
openshift-apiserver-operator openshift-apiserver-operator-79cb44596f-ckx7t 1/1 Running 2 4h53m
openshift-apiserver apiserver-6cd699c8b7-ph4mk 2/2 Running 0 4h42m
openshift-apiserver apiserver-6cd699c8b7-wkqh7 2/2 Running 0 4h41m
openshift-apiserver apiserver-6cd699c8b7-wvkh6 2/2 Running 0 4h41m
openshift-authentication-operator authentication-operator-7f677f7559-wfd42 1/1 Running 2 4h53m
openshift-authentication oauth-openshift-6d6b5fcfbb-mp7l8 1/1 Running 0 4h33m
openshift-authentication oauth-openshift-6d6b5fcfbb-t7zcq 1/1 Running 0 4h33m
openshift-authentication oauth-openshift-6d6b5fcfbb-wdfcj 1/1 Running 0 4h33m
openshift-cloud-credential-operator cloud-credential-operator-5ff6dbff57-4hgq4 2/2 Running 0 4h53m
openshift-cluster-machine-approver machine-approver-757975f664-ptdql 2/2 Running 0 4h53m
openshift-cluster-node-tuning-operator cluster-node-tuning-operator-7bb4c7584d-9fwlj 1/1 Running 0 4h53m
openshift-cluster-node-tuning-operator tuned-289pj 1/1 Running 0 4h47m
openshift-cluster-node-tuning-operator tuned-2ccq9 1/1 Running 0 4h46m
openshift-cluster-node-tuning-operator tuned-9l6p2 1/1 Running 0 3h51m
openshift-cluster-node-tuning-operator tuned-w98p7 1/1 Running 0 4h42m
openshift-cluster-samples-operator cluster-samples-operator-7c499478dc-zmgkn 2/2 Running 0 4h41m
< 생략 >
2. Pod 세부 내용 확인
oc describe pod <pod name>
-> pod의 세부사항 확인 가능
[root@bastion config]#oc get pods -n openshift-sdn
NAME READY STATUS RESTARTS AGE
sdn-controller-fjn25 1/1 Running 0 4h50m
sdn-controller-tj9c4 1/1 Running 0 4h46m
sdn-controller-vfnsq 1/1 Running 2 4h52m
sdn-g2n8c 2/2 Running 0 4h46m
sdn-q9kvt 2/2 Running 0 4h52m
sdn-wp9gg 2/2 Running 0 3h55m
sdn-xmhxx 2/2 Running 0 4h50m
[root@bastion config]#oc describe pod sdn-g2n8c -n openshift-sdn
Name: sdn-g2n8c
Namespace: openshift-sdn
Priority: 2000001000
Priority Class Name: system-node-critical
Node: master3.ocp-dc.hk.com/55.55.35.213
Start Time: Tue, 09 Nov 2021 09:48:04 +0900
Labels: app=sdn
component=network
< 생략 >
3. Pod 로그 확인
oc logs <pod name>
-> pod 에러등이 발생했을 때 주로 사용
[root@bastion config]#oc logs oauth-openshift-6d6b5fcfbb-mp7l8
Copying system trust bundle
I1109 00:57:12.374789 1 dynamic_serving_content.go:111] Loaded a new cert/key pair for "serving-cert::/var/config/system/secrets/v4-0-config-system-serving-cert/tls.crt::/var/config/system/secrets/v4-0-config-system-serving-cert/tls.key"
I1109 00:57:12.375181 1 dynamic_serving_content.go:111] Loaded a new cert/key pair for "sni-serving-cert::/var/config/system/secrets/v4-0-config-system-router-certs/apps.ocp-dc.hk.com::/var/config/system/secrets/v4-0-config-system-router-certs/apps.ocp-dc.hk.com"
I1109 00:57:12.929620 1 requestheader_controller.go:244] Loaded a new request header values for RequestHeaderAuthRequestController
4. Pod 삭제
oc delete <pod name>
-> 특정 pod를 삭제합니다. deployment 배포 정책으로 생성한 파드의 경우에는 파드를 지워도 아래와 같이 다시 설정된 수 만큼의 파드를 유지하기 위해 재 생성합니다. 이러한 정책이 없이 배포하였다면 다시 생성되지 않고 지워집니다.
[root@bastion config]#oc get pods
NAME READY STATUS RESTARTS AGE
oauth-openshift-6d6b5fcfbb-mp7l8 1/1 Running 0 4h43m
oauth-openshift-6d6b5fcfbb-t7zcq 1/1 Running 0 4h43m
oauth-openshift-6d6b5fcfbb-wdfcj 1/1 Running 0 4h43m
[root@bastion config]#oc delete pods oauth-openshift-6d6b5fcfbb-mp7l8
pod "oauth-openshift-6d6b5fcfbb-mp7l8" deleted
[root@bastion config]#oc get pods
NAME READY STATUS RESTARTS AGE
oauth-openshift-6d6b5fcfbb-5f6t7 1/1 Running 0 37s
oauth-openshift-6d6b5fcfbb-t7zcq 1/1 Running 0 4h44m
oauth-openshift-6d6b5fcfbb-wdfcj 1/1 Running 0 4h44m
5. Pod 자원 사용량 확인
oc adm top pods
-> 각 pod들의 사용량을 확인할 수 있습니다.
[root@bastion config]#oc adm top pods
W1109 14:42:50.312988 46048 top_pod.go:140] Using json format to get metrics. Next release will switch to protocol-buffers, switch early by passing --use-protocol-buffers flag
NAME CPU(cores) MEMORY(bytes)
oauth-openshift-6d6b5fcfbb-5f6t7 4m 22Mi
oauth-openshift-6d6b5fcfbb-t7zcq 2m 45Mi
oauth-openshift-6d6b5fcfbb-wdfcj 3m 42Mi
728x90
'Cloud > RedHat - OpenShift' 카테고리의 다른 글
[RHOCP4] virtctl 설치방법 (0) | 2021.12.08 |
---|---|
[RHOCP4] RHEL7 worker 노드 추가 (0) | 2021.11.09 |
[RHOCP4] openshift4 node 관리 (0) | 2021.11.09 |
[RHOCP4] OpenShift4 테스트 환경 설치 (4.8.14) (6) | 2021.11.08 |
[RHOCP4] Openshift - PXE를 통한 RHCOS work node 설치 (0) | 2021.09.13 |