수집기 문제 해결

Red Hat Advanced Cluster Security for Kubernetes 3.73

수집기 문제 해결

Red Hat OpenShift Documentation Team

초록

이 가이드를 사용하여 실패한 수집기에서 로그를 검색하고 디버그하는 방법을 알아봅니다.

1장. 수집기 로그 및 Pod 상태 검색 및 분석

문제 해결의 첫 번째 단계는 로그 및 Pod 상태를 검색하는 것입니다. 로그를 사용하면 오류의 근본 원인을 확인할 수 있습니다. 또한 Pod의 최신 상태를 검사하면 오류 메시지에 대한 정보를 제공할 수 있습니다.

1.1. 수집기 로그 검색

먼저 실패한 수집기의 로그를 검사해야 합니다. 환경 및 액세스 권한에 따라 다음 두 가지 방법으로 이러한 로그를 얻을 수 있습니다.

1.1.1. oc 또는 kubectl 명령을 사용하여 로그 검색

oc 또는 kubectl 명령을 사용하여 실행 중인 수집기 Pod에서 로그를 가져올 수 있습니다. 선택적으로 현재 수집기 Pod가 다시 시작되는 경우 이전 수집기 Pod의 로그를 확인할 수 있습니다.

사전 요구 사항

  • Pod 및 로그를 나열할 수 있는 권한이 있는지 확인합니다.

    $ oc auth can-i get pods && oc auth can-i get pods --subresource=logs 1
    1
    Kubernetes를 사용하는 경우 oc.. 대신 kubectl 을 입력합니다.

절차

  1. app=collector 레이블이 있는 모든 Pod를 나열합니다.

    $ oc get pods -n stackrox -l app=collector 1
    1
    Kubernetes를 사용하는 경우 oc.. 대신 kubectl 을 입력합니다.

    출력 예

    collector-vclg5    1/2     CrashLoopBackOff   2 (25s ago)   2m41s+

  2. 수집기 Pod의 로그를 가져옵니다.

    $ oc logs -n stackrox <collector_pod_name> collector 1
    1
    Kubernetes를 사용하는 경우 oc.. 대신 kubectl 을 입력합니다. & lt;collector_pod_name >의 경우 수집기 Pod의 이름을 지정합니다(예: collector-vclg5 ).
  3. (선택 사항) 현재 수집기 Pod가 재시작되는 경우 이전 수집기 Pod의 로그를 확인할 수 있습니다.

    $ oc logs -n stackrox <collector_pod_name> collector --previous 1
    1
    Kubernetes를 사용하는 경우 oc.. 대신 kubectl 을 입력합니다. & lt;collector_pod_name >의 경우 수집기 Pod의 이름을 지정합니다(예: collector-vclg5 ).

1.1.2. RHACS 진단 번들에서 로그 검색

RHACS(Red Hat Advanced Cluster Security for Kubernetes) 사용자 인터페이스에서 진단 번들을 다운로드하여 수집기 로그에 액세스할 수도 있습니다. 진단 번들을 다운로드한 후에는 모든 수집기 Pod의 로그를 검사할 수 있습니다. 자세한 내용은 진단 번들 생성을 참조하십시오.

1.2. 수집기 Pod 상태 분석

Pod의 최신 상태를 검사하는 것은 수집기 충돌의 원인을 확인하기 위한 또 다른 쉬운 방법입니다. 실패 메시지는 가장 최근 상태에 기록되며 kubectl describe pod 또는 oc describe pod 명령을 사용하여 액세스할 수 있습니다.

절차

  • 수집기 Pod를 설명합니다.

    $ oc describe pod -n stackrox <collector_pod_name> 1
    1
    Kubernetes를 사용하는 경우 oc.. 대신 kubectl 을 입력합니다. & lt;collector_pod_name >의 경우 수집기 Pod의 이름을 지정합니다(예: collector-vclg5 ).

    출력 예

    [...]
        Last State:     Terminated
          Reason:       Error
          Message:      No suitable kernel object downloaded 1
          Exit Code:    1
          Started:      Fri, 21 Oct 2022 11:50:56 +0100
          Finished:     Fri, 21 Oct 2022 11:51:25 +0100
    [...]

    1
    이 예제에서는 수집기가 커널 드라이버를 다운로드하지 못한 것을 확인할 수 있습니다.

2장. 일반적으로 발생하는 오류 상태

수집기가 자체적으로 구성되고 시스템의 커널 드라이버를 검색하거나 다운로드할 때 수집기 시작 중에 대부분의 오류가 발생합니다.

다음 다이어그램에서는 수집기 시작 프로세스의 주요 부분을 설명합니다.

그림 2.1. 수집기 Pod 시작 프로세스

수집기 Pod 시작 프로세스

시작 절차의 일부가 실패하면 로그에 성공 또는 실패한 단계를 자세히 설명하는 진단 요약이 표시됩니다.

다음 로그 파일 예제에서는 시작 성공 사례를 보여줍니다.

[INFO    2022/11/28 13:21:55] == Collector Startup Diagnostics: ==
[INFO    2022/11/28 13:21:55]  Connected to Sensor?       true
[INFO    2022/11/28 13:21:55]  Kernel driver available?   true
[INFO    2022/11/28 13:21:55]  Driver loaded into kernel? true
[INFO    2022/11/28 13:21:55] ====================================

로그 출력은 센서에 연결되고 커널 드라이버를 로드한 수집기를 확인합니다. 이 로그를 사용하여 수집기의 성공적인 시작을 확인할 수 있습니다.

2.1. 센서에 연결할 수 없음

시작할 때 먼저 센서에 연결할 수 있는지 확인하십시오. 센서는 네트워크 이벤트 처리를 위한 커널 드라이버 및 CIDR 블록을 다운로드하여 시작 프로세스의 필수 요소로 합니다. 다음 로그는 센서에 연결할 수 없음을 나타냅니다.

Collector Version: 3.12.0
OS: Ubuntu 20.04.4 LTS
Kernel Version: 5.4.0-126-generic
Starting StackRox Collector...
[INFO    2022/10/13 12:20:43] Hostname: 'hostname'
[...]
[INFO    2022/10/13 12:20:43] Sensor configured at address: sensor.stackrox.svc:9998
[INFO    2022/10/13 12:20:43] Attempting to connect to Sensor
[INFO    2022/10/13 12:21:13]
[INFO    2022/10/13 12:21:13] == Collector Startup Diagnostics: ==
[INFO    2022/10/13 12:21:13]  Connected to Sensor?       false
[INFO    2022/10/13 12:21:13]  Kernel driver available?   false
[INFO    2022/10/13 12:21:13]  Driver loaded into kernel? false
[INFO    2022/10/13 12:21:13] ====================================
[INFO    2022/10/13 12:21:13]
[FATAL   2022/10/13 12:21:13] Unable to connect to Sensor.

이 오류는 센서가 올바르게 시작되지 않았거나 수집기 구성이 잘못되었음을 의미할 수 있습니다. 이 문제를 해결하려면 Sensor 주소가 올바르며 센서 Pod가 올바르게 실행되고 있는지 확인하려면 수집기 구성을 확인해야 합니다.

수집기 로그를 보고 구성된 센서 주소를 구체적으로 확인합니다. 또는 다음 명령을 실행할 수 있습니다.

$ kubectl -n stackrox get pod <collector_pod_name> -o jsonpath='{.spec.containers[0].env[?(@.name=="GRPC_SERVER")].value}' 1
1
& lt;collector_pod_name >의 경우 수집기 Pod의 이름을 지정합니다(예: collector-vclg5 ).

2.2. 커널 드라이버를 사용할 수 없음

수집기는 노드의 커널 버전에 대한 커널 드라이버가 있는지 확인합니다. 수집기는 먼저 올바른 버전 및 유형이 있는 드라이버를 검색한 다음 Sensor에서 드라이버를 다운로드하려고 합니다. 다음 로그는 Sensor의 로컬 커널 드라이버와 드라이버가 모두 없음을 나타냅니다.

Collector Version: 3.12.0
OS: Alpine Linux v3.14
Kernel Version: 5.10.109-0-virt
Starting StackRox Collector...
[INFO    2022/10/13 13:32:57] Hostname: 'alpine'
[...]
[INFO    2022/10/13 13:32:57] Sensor configured at address: sensor.stackrox.svc:9999
[INFO    2022/10/13 13:32:57] Attempting to connect to Sensor
[INFO    2022/10/13 13:32:57] Successfully connected to Sensor.
[INFO    2022/10/13 13:32:57] Module version: 2.2.0
[INFO    2022/10/13 13:32:57] Attempting to find kernel module - Candidate kernel versions:
[INFO    2022/10/13 13:32:57] 5.10.109-0-virt
[INFO    2022/10/13 13:32:57] Local storage does not contain collector-5.10.109-0-virt.ko
[...]
[INFO    2022/10/13 13:32:57] Attempting to download kernel object from https://sensor.stackrox.svc/kernel-objects/2.2.0/collector-5.10.109-0-virt.ko.gz 1
[WARNING 2022/10/13 13:32:58] [Throttled] Unexpected HTTP request failure (HTTP 404) 2
[WARNING 2022/10/13 13:33:08] [Throttled] Unexpected HTTP request failure (HTTP 404)
[WARNING 2022/10/13 13:33:18] [Throttled] Unexpected HTTP request failure (HTTP 404)
[WARNING 2022/10/13 13:33:29] [Throttled] Unexpected HTTP request failure (HTTP 404)
[WARNING 2022/10/13 13:33:35] Attempted to download collector-5.10.109-0-virt.ko.gz 30 time(s)
[WARNING 2022/10/13 13:33:35] Failed to download from collector-5.10.109-0-virt.ko.gz
[WARNING 2022/10/13 13:33:35] Unable to download kernel object collector-5.10.109-0-virt.ko to /module/collector.ko.gz
[ERROR   2022/10/13 13:33:35] Error getting kernel object: collector-5.10.109-0-virt.ko
[INFO    2022/10/13 13:33:35]
[INFO    2022/10/13 13:33:35] == Collector Startup Diagnostics: ==
[INFO    2022/10/13 13:33:35]  Connected to Sensor?       true
[INFO    2022/10/13 13:33:35]  Kernel driver available?   false
[INFO    2022/10/13 13:33:35]  Driver loaded into kernel? false
[INFO    2022/10/13 13:33:35] ====================================
[INFO    2022/10/13 13:33:35]
[FATAL   2022/10/13 13:33:35]  No suitable kernel object downloaded for kernel 5.10.109-0-virt 3
1
로그 디스플레이는 먼저 모듈을 찾은 다음 센서에서 드라이버를 다운로드하려고 시도합니다.
2
404 오류는 노드의 커널에 커널 드라이버가 없음을 나타냅니다.
3
드라이버가 누락된 결과 수집기는 CrashLoopBackOff 상태가 됩니다.

커널 버전 파일에는 지원되는 모든 커널 버전 목록이 포함되어 있습니다.

2.3. 커널 드라이버를 로드하지 못했습니다.

수집기가 시작되기 전에 커널 드라이버를 로드합니다. 그러나 드문 경우지만 수집기가 커널 드라이버를 로드할 수 없는 문제가 발생하여 다양한 오류 메시지 또는 예외가 발생할 수 있습니다. 이러한 경우 로그를 확인하여 커널 드라이버를 로드할 때 발생하는 문제를 식별해야 합니다.

다음 수집기 로그를 고려합니다.

[INFO    2022/10/13 14:25:13] Hostname: 'hostname'
[...]
[INFO    2022/10/13 14:25:13] Successfully downloaded and decompressed /module/collector.ko
[INFO    2022/10/13 14:25:13]
[INFO    2022/10/13 14:25:13] This product uses kernel module and ebpf subcomponents licensed under the GNU
[INFO    2022/10/13 14:25:13] GENERAL PURPOSE LICENSE Version 2 outlined in the /kernel-modules/LICENSE file.
[INFO    2022/10/13 14:25:13] Source code for the kernel module and ebpf subcomponents is available upon
[INFO    2022/10/13 14:25:13] request by contacting support@stackrox.com.
[INFO    2022/10/13 14:25:13]
[...]
[INFO    2022/10/13 14:25:13] Inserting kernel module /module/collector.ko with indefinite removal and retry if required.
[ERROR   2022/10/13 14:25:13] Error inserting kernel module: /module/collector.ko: Operation not permitted. Aborting...
[ERROR   2022/10/13 14:25:13] Failed to insert kernel module
[ERROR   2022/10/13 14:25:13] Failed to setup Kernel module
[INFO    2022/10/13 14:25:13]
[INFO    2022/10/13 14:25:13] == Collector Startup Diagnostics: ==
[INFO    2022/10/13 14:25:13]  Connected to Sensor?       true
[INFO    2022/10/13 14:25:13]  Kernel driver available?   true
[INFO    2022/10/13 14:25:13]  Driver loaded into kernel? false
[INFO    2022/10/13 14:25:13] ====================================
[INFO    2022/10/13 14:25:13]
[FATAL   2022/10/13 14:25:13] Failed to initialize collector kernel components.

이러한 종류의 오류가 발생하면 직접 수정할 수 있습니다. 따라서 대신 RHACS(Red Hat Advanced Cluster Security for Kubernetes) 지원 팀에 보고하거나 GitHub 문제를 생성합니다.

법적 공지

Copyright © 2023 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.