promtool HTTP 클라이언트 구성

promtool HTTP 클라이언트 구성 (promtool HTTP client configuration)

promtool이 Prometheus 서버와 통신할 때 사용하는 HTTP 클라이언트를 구성하는 방법을 설명하는 문서예요. TLS, 프록시, 커스텀 CA, 클라이언트 인증서, HTTP 헤더(credential) 등을 --http.config.file 플래그로 넘기는 YAML 파일에 설정할 수 있어요. 이 문서는 커맨드라인에서 promtool로 서버에 접근할 때 인증이나 TLS가 필요한 상황에서 꼭 필요한 내용이에요.

구성 파일은 http_config 섹션 아래에 TLS(tls_config), 프록시(proxy_url, proxy_from_environment), 헤더(headers), 시크릿(secrets) 같은 옵션을 담아요. YAML 키와 값은 그대로 두고, 각각의 의미를 한국어로 풀어드릴게요.

출처: 문서

본문

HTTP 클라이언트 구성 (HTTP client configuration)

HTTP 헤더 (HTTP Header)

HTTP 클라이언트 구성은 promtool에 자격 증명(credential)을 제공하는 HTTP 헤더를 포함할 수 있어요.

http_config:
  headers:
    X-Scope-OrgID: "acme"
    Authorization: "Bearer <token>"

구성이 지원하는 것:

  • http_config.headers의 HTTP 헤더

  • http_config.secrets의 시크릿(실험적)

파일시스템 리더 (Filesystem reader)

promtool이 HTTP 클라이언트 구성용 구성 파일을 필요로 하면 기본적으로 파일시스템에서 읽어요. 구성은 선택 사항이므로, 값은 환경 변수나 시크릿 참조를 통해 인라인으로 제공할 수도 있어요.

promtool 플래그의 HTTP 클라이언트 지시자 (HTTP client directive in promtool flags)

--http.config.file은 폴더 경로 또는 파일 경로를 기대해요.

  • 디렉터리라면 그 디렉터리의 promtool-http.yml을 읽어요.

  • 파일이라면 정확히 그 파일을 읽어요.

구체적인 제어:

http_config:
  tls_config:
    ca_file: "/path/to/CA"
    cert_file: "/path/to/cert"
    key_file: "/path/to/key"

그리고 프록시로의 HTTP 읽기/쓰기:

http_config:
  proxy_url: http://proxy.example.com:3128

상응하는 http_config.proxy_from_environment와 함께:

http_config:
  proxy_from_environment: true

TLS 구성 (TLS configuration)

이 설정에 대한 Go 구성은 golang.org/pkg/crypto/tls에서 찾을 수 있어요.

http_config:
  tls_config:
    ca_file: "/path/to/CA"
    cert_file: "/path/to/cert"
    key_file: "/path/to/key"
    server_name: "example.com"
    insecure_skip_verify: true

클라이언트와 서버 모두에 대해:

http_config:
  tls_config:
    min_version: TLS12
    max_version: TLS13
    ciphers:
      - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
      - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384

TLS 검증 (TLS verification)

제공된 인증서의 검증은 유지하면서 TLS를 비활성화하려면 insecure_skip_verify: true를 설정하세요. 둘 다 비활성화하려면 insecure_skip_verify: trueca_file: ""를 설정하세요.

커스텀 CA와 클라이언트 인증서 (Custom CA and client certificates)

http_config:
  tls_config:
    ca_file: "/path/to/ca.crt"
    cert_file: "/path/to/cert.crt"
    key_file: "/path/to/key.pem"

TLS 버전 (TLS versions)

최소 및 최대 TLS 버전을 TLS 1.2(또는 그 이상)로 설정하는 것은 더 오래된 안전하지 않은 프로토콜 버전의 사용을 방지하기 위해 권장되며 요구돼요.

http_config:
  tls_config:
    min_version: TLS12
    max_version: TLS13

암호 스위트 (Cipher suites)

암호 스위트를 지정할 수 있어요. Go의 tls 패키지가 받아들이는 형식(TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 등)이어야 해요.

http_config:
  tls_config:
    ciphers:
      - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
      - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384

HTTP 클라이언트 폴백 (HTTP client fallbacks)

--http.config.file 플래그는 쉼표로 구분된 폴백 목록을 받아들이며, 각 항목은 디렉터리 또는 파일의 경로예요.

--http.config.file=config1.yml,config2.yml,config3.yml

구성 파일은 순서대로 검색되고 존재하는 첫 번째 파일이 사용돼요.

더 알아보기 (Learn more)