소개
게시글
질문&답변
2022.09.05
7.7 실습문의
방금 전에 실습 했더니 정상적으로 실행 됩니다. 다음 부터는 문제가 발생되면 logs, describe 명령으로 확인해 보고 문의 드리겠습니다.================================================[root@m-k8s 7.7]# kubectl get podsNAME READY STATUS RESTARTS AGEnet 1/1 Running 5 (3m46s ago) 3d12hnfs-client-provisioner-7884c4db4-qz75l 1/1 Running 8 (3m46s ago) 8dpod-adapter 2/2 Running 3 (2m9s ago) 2m43s[root@m-k8s 7.7]# kubectl logs pod-adapter web-page/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d//docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh10-listen-on-ipv6-by-default.sh: info: can not modify /etc/nginx/conf.d/default.conf (read-only file system?)/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh/docker-entrypoint.sh: Configuration complete; ready for start up2022/09/05 01:39:21 [notice] 1#1: using the "epoll" event method2022/09/05 01:39:21 [notice] 1#1: nginx/1.23.12022/09/05 01:39:21 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6)2022/09/05 01:39:21 [notice] 1#1: OS: Linux 3.10.0-1127.19.1.el7.x86_642022/09/05 01:39:21 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:10485762022/09/05 01:39:21 [notice] 1#1: start worker processes2022/09/05 01:39:21 [notice] 1#1: start worker process 23127.0.0.1 - - [05/Sep/2022:01:40:19 +0000] "GET /stub_status HTTP/1.1" 200 97 "-" "NGINX-Prometheus-Exporter/v0.9.0" "-"[root@m-k8s 7.7]# kubectl logs pod-adapter adapter2022/09/05 01:40:19 Starting NGINX Prometheus Exporter version=0.9.0 commit=5f88afbd906baae02edfbab4f5715e06d88538a0 date=2021-03-22T20:16:09Z2022/09/05 01:40:19 Listening on :91132022/09/05 01:40:19 NGINX Prometheus Exporter has successfully started[root@m-k8s 7.7]# kubectl describe pod pod-adapterName: pod-adapterNamespace: defaultPriority: 0Node: w3-k8s/192.168.1.103Start Time: Mon, 05 Sep 2022 10:39:18 +0900Labels: app=nginxAnnotations: cni.projectcalico.org/podIP: 172.16.132.38/32 cni.projectcalico.org/podIPs: 172.16.132.38/32Status: RunningIP: 172.16.132.38IPs: IP: 172.16.132.38Containers: web-page: Container ID: docker://6f15cef63e3bcf8982bf68dc19e3f43f0ab47032299eedfe294a13b122690cdb Image: nginx Image ID: docker-pullable://nginx@sha256:b95a99feebf7797479e0c5eb5ec0bdfa5d9f504bc94da550c2f58e839ea6914f Port: Host Port: State: Running Started: Mon, 05 Sep 2022 10:39:21 +0900 Ready: True Restart Count: 0 Environment: Mounts: /etc/nginx/conf.d from nginx-conf (rw) /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-wj5gm (ro) adapter: Container ID: docker://09a94aad41f433bd97529142a4c8584c34d85f35a23e46d1f700e2846a0c53d8 Image: nginx/nginx-prometheus-exporter:0.9.0 Image ID: docker-pullable://nginx/nginx-prometheus-exporter@sha256:0caaabffc24204ca72f79c22d222bc7ddbc16355a65a3661c7d17a9a4991aa68 Port: 9113/TCP Host Port: 0/TCP State: Running Started: Mon, 05 Sep 2022 10:40:19 +0900 Last State: Terminated Reason: Error Exit Code: 1 Started: Mon, 05 Sep 2022 10:39:47 +0900 Finished: Mon, 05 Sep 2022 10:39:52 +0900 Ready: True Restart Count: 3 Environment: SCRAPE_URI: http://localhost/stub_status Mounts: /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-wj5gm (ro)Conditions: Type Status Initialized True Ready True ContainersReady True PodScheduled TrueVolumes: nginx-conf: Type: ConfigMap (a volume populated by a ConfigMap) Name: nginx-conf Optional: false kube-api-access-wj5gm: Type: Projected (a volume that contains injected data from multiple sources) TokenExpirationSeconds: 3607 ConfigMapName: kube-root-ca.crt ConfigMapOptional: DownwardAPI: trueQoS Class: BestEffortNode-Selectors: Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s node.kubernetes.io/unreachable:NoExecute op=Exists for 300sEvents: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Scheduled 3m53s default-scheduler Successfully assigned default/pod-adapter to w3-k8s Normal Pulling 3m52s kubelet Pulling image "nginx" Normal Pulled 3m50s kubelet Successfully pulled image "nginx" in 2.45375911s Normal Created 3m50s kubelet Created container web-page Normal Started 3m50s kubelet Started container web-page Warning BackOff 3m5s (x3 over 3m37s) kubelet Back-off restarting failed container Normal Pulled 2m52s (x4 over 3m50s) kubelet Container image "nginx/nginx-prometheus-exporter:0.9.0" already present on machine Normal Created 2m52s (x4 over 3m50s) kubelet Created container adapter Normal Started 2m52s (x4 over 3m50s) kubelet Started container adapter[root@m-k8s 7.7]# kubectl get nodes -o wideNAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIMEm-k8s Ready control-plane,master 19d v1.22.0 192.168.1.10 CentOS Linux 7 (Core) 3.10.0-1127.19.1.el7.x86_64 docker://20.10.8w1-k8s Ready 19d v1.22.0 192.168.1.101 CentOS Linux 7 (Core) 3.10.0-1127.19.1.el7.x86_64 docker://20.10.8w2-k8s Ready 19d v1.22.0 192.168.1.102 CentOS Linux 7 (Core) 3.10.0-1127.19.1.el7.x86_64 docker://20.10.8w3-k8s Ready 19d v1.22.0 192.168.1.103 CentOS Linux 7 (Core) 3.10.0-1127.19.1.el7.x86_64 docker://20.10.8 [root@m-k8s 7.7]# curl 172.16.132.38/stub_statusActive connections: 1server accepts handled requests 2 2 2Reading: 0 Writing: 1 Waiting: 0 [root@m-k8s 7.7]# curl 172.16.132.38:9113/metrics# HELP nginx_connections_accepted Accepted client connections# TYPE nginx_connections_accepted counternginx_connections_accepted 3# HELP nginx_connections_active Active client connections# TYPE nginx_connections_active gaugenginx_connections_active 1# HELP nginx_connections_handled Handled client connections# TYPE nginx_connections_handled counternginx_connections_handled 3# HELP nginx_connections_reading Connections where NGINX is reading the request header# TYPE nginx_connections_reading gaugenginx_connections_reading 0# HELP nginx_connections_waiting Idle client connections# TYPE nginx_connections_waiting gaugenginx_connections_waiting 0# HELP nginx_connections_writing Connections where NGINX is writing the response back to the client# TYPE nginx_connections_writing gaugenginx_connections_writing 1# HELP nginx_http_requests_total Total http requests# TYPE nginx_http_requests_total counternginx_http_requests_total 3# HELP nginx_up Status of the last metric scrape# TYPE nginx_up gaugenginx_up 1# HELP nginxexporter_build_info Exporter build information# TYPE nginxexporter_build_info gaugenginxexporter_build_info{commit="5f88afbd906baae02edfbab4f5715e06d88538a0",date="2021-03-22T20:16:09Z",version="0.9.0"} 1
- 0
- 2
- 276
질문&답변
2022.09.05
7.8 실습문의
pod-antiAffinity 설정후 pod 4개 배포시 w2-k8s 쪽으로 파드 4개가 모두 배포 되는 걸로 실습 예제에 나와 있는데요. 실제 실행을 해 보니 w2-k8s쪽 2개, w3-k8s쪽 2개로 배포가 되어서 생성된 파드를 scale 명령으로 replicas=1로 배포하고 다시 scale 명령으로 replicas=4로 배포를 했습니다. 결과가 w2-k8s쪽 2개, w3-k8s쪽 2개로 배포되어서 왜 이렇게 배포가 되는지 궁금해서 문의 했습니다.
- 0
- 3
- 293