Istio¶
Istio 성능 지표 표시, Incoming Request Volume, Incoming Success Rate, Incoming Requests By Source And Response Code, Outgoing Requests By Destination And Response Code 등 포함.
수집기 설정¶
사전 조건¶
-
Kubernetes가 배포되어 있어야 합니다.
-
DataKit가 배포되어 있어야 합니다. Kubernetes 클러스터에서는 <Datakit 설치>를 참고하세요.
-
Istio가 배포되어 있어야 합니다.
설명: 예시 Istio 버전은 1.11.2입니다.
DataKit 설정¶
apiVersion: v1
kind: ConfigMap
metadata:
name: datakit-conf
namespace: datakit
data: # 아래는 추가된 부분
prom_istiod.conf: |-
[[inputs.prom]]
url = "http://istiod.istio-system.svc.cluster.local:15014/metrics"
source = "prom-istiod"
metric_types = ["counter", "gauge"]
interval = "60s"
tags_ignore = ["cache","cluster_type","component","destination_app","destination_canonical_revision","destination_canonical_service","destination_cluster","destination_principal","group","grpc_code","grpc_method","grpc_service","grpc_type","reason","request_protocol","request_type","resource","responce_code_class","response_flags","source_app","source_canonical_revision","source_canonical-service","source_cluster","source_principal","source_version","wasm_filter"]
metric_name_filter = ["istio_requests_total","pilot_k8s_cfg_events","istio_build","process_virtual_memory_bytes","process_resident_memory_bytes","process_cpu_seconds_total","envoy_cluster_assignment_stale","go_goroutines","pilot_xds_pushes","pilot_proxy_convergence_time_bucket","citadel_server_root_cert_expiry_timestamp","pilot_conflict_inbound_listener","pilot_conflict_outbound_listener_http_over_current_tcp","pilot_conflict_outbound_listener_tcp_over_current_tcp","pilot_conflict_outbound_listener_tcp_over_current_http","pilot_virt_services","galley_validation_failed","pilot_services","envoy_cluster_upstream_cx_total","envoy_cluster_upstream_cx_connect_fail","envoy_cluster_upstream_cx_active","envoy_cluster_upstream_cx_rx_bytes_total","envoy_cluster_upstream_cx_tx_bytes_total","istio_request_duration_milliseconds_bucket","istio_request_duration_seconds_bucket","istio_request_bytes_bucket","istio_response_bytes_bucket"]
#measurement_prefix = ""
measurement_name = "istio_prom"
#[[inputs.prom.measurements]]
# prefix = "cpu_"
# name ="cpu"
[inputs.prom.tags]
app_id="istiod"
#### ingressgateway
prom-ingressgateway.conf: |-
[[inputs.prom]]
url = "http://istio-ingressgateway-ext.istio-system.svc.cluster.local:15020/stats/prometheus"
source = "prom-ingressgateway"
metric_types = ["counter", "gauge"]
interval = "60s"
tags_ignore = ["cache","cluster_type","component","destination_app","destination_canonical_revision","destination_canonical_service","destination_cluster","destination_principal","group","grpc_code","grpc_method","grpc_service","grpc_type","reason","request_protocol","request_type","resource","responce_code_class","response_flags","source_app","source_canonical_revision","source_canonical-service","source_cluster","source_principal","source_version","wasm_filter"]
metric_name_filter = ["istio_requests_total","pilot_k8s_cfg_events","istio_build","process_virtual_memory_bytes","process_resident_memory_bytes","process_cpu_seconds_total","envoy_cluster_assignment_stale","go_goroutines","pilot_xds_pushes","pilot_proxy_convergence_time_bucket","citadel_server_root_cert_expiry_timestamp","pilot_conflict_inbound_listener","pilot_conflict_outbound_listener_http_over_current_tcp","pilot_conflict_outbound_listener_tcp_over_current_tcp","pilot_conflict_outbound_listener_tcp_over_current_http","pilot_virt_services","galley_validation_failed","pilot_services","envoy_cluster_upstream_cx_total","envoy_cluster_upstream_cx_connect_fail","envoy_cluster_upstream_cx_active","envoy_cluster_upstream_cx_rx_bytes_total","envoy_cluster_upstream_cx_tx_bytes_total","istio_request_duration_milliseconds_bucket","istio_request_duration_seconds_bucket","istio_request_bytes_bucket","istio_response_bytes_bucket"]
#measurement_prefix = ""
measurement_name = "istio_prom"
#[[inputs.prom.measurements]]
# prefix = "cpu_"
# name ="cpu"
#### egressgateway
prom-egressgateway.conf: |-
[[inputs.prom]]
url = "http://istio-egressgateway-ext.istio-system.svc.cluster.local:15020/stats/prometheus"
source = "prom-egressgateway"
metric_types = ["counter", "gauge"]
interval = "60s"
tags_ignore = ["cache","cluster_type","component","destination_app","destination_canonical_revision","destination_canonical_service","destination_cluster","destination_principal","group","grpc_code","grpc_method","grpc_service","grpc_type","reason","request_protocol","request_type","resource","responce_code_class","response_flags","source_app","source_canonical_revision","source_canonical-service","source_cluster","source_principal","source_version","wasm_filter"]
metric_name_filter = ["istio_requests_total","pilot_k8s_cfg_events","istio_build","process_virtual_memory_bytes","process_resident_memory_bytes","process_cpu_seconds_total","envoy_cluster_assignment_stale","go_goroutines","pilot_xds_pushes","pilot_proxy_convergence_time_bucket","citadel_server_root_cert_expiry_timestamp","pilot_conflict_inbound_listener","pilot_conflict_outbound_listener_http_over_current_tcp","pilot_conflict_outbound_listener_tcp_over_current_tcp","pilot_conflict_outbound_listener_tcp_over_current_http","pilot_virt_services","galley_validation_failed","pilot_services","envoy_cluster_upstream_cx_total","envoy_cluster_upstream_cx_connect_fail","envoy_cluster_upstream_cx_active","envoy_cluster_upstream_cx_rx_bytes_total","envoy_cluster_upstream_cx_tx_bytes_total","istio_request_duration_milliseconds_bucket","istio_request_duration_seconds_bucket","istio_request_bytes_bucket","istio_response_bytes_bucket"]
#measurement_prefix = ""
measurement_name = "istio_prom"
#[[inputs.prom.measurements]]
# prefix = "cpu_"
# name ="cpu"
apiVersion: apps/v1
kind: DaemonSet
...
spec:
template
spec:
containers:
- env:
volumeMounts: # 아래는 추가된 부분
- mountPath: /usr/local/datakit/conf.d/prom/prom_istiod.conf
name: datakit-conf
subPath: prom_istiod.conf
- mountPath: /usr/local/datakit/conf.d/prom/prom-ingressgateway.conf
name: datakit-conf
subPath: prom-ingressgateway.conf
- mountPath: /usr/local/datakit/conf.d/prom/prom-egressgateway.conf
name: datakit-conf
subPath: prom-egressgateway.conf
DataKit 재배포
애플리케이션 연동 설정¶
Envoy 지표 수집기를 활성화합니다.
업무 Pod에 아래 annotations를 추가합니다(구체적인 경로는 spec.template.metadata 아래). 이렇게 하면 Envoy의 지표 데이터를 수집할 수 있습니다.
apiVersion: apps/v1
kind: Deployment
metadata:
name: productpage-v1
spec:
template:
metadata:
...
annotations: # 아래는 추가된 부분
datakit/prom.instances: |
[[inputs.prom]]
url = "http://$IP:15020/stats/prometheus"
source = "bookinfo-istio-product"
metric_types = ["counter", "gauge"]
interval = "60s"
tags_ignore = ["cache","cluster_type","component","destination_app","destination_canonical_revision","destination_canonical_service","destination_cluster","destination_principal","group","grpc_code","grpc_method","grpc_service","grpc_type","reason","request_protocol","request_type","resource","responce_code_class","response_flags","source_app","source_canonical_revision","source_canonical-service","source_cluster","source_principal","source_version","wasm_filter"]
metric_name_filter = ["istio_requests_total","pilot_k8s_cfg_events","istio_build","process_virtual_memory_bytes","process_resident_memory_bytes","process_cpu_seconds_total","envoy_cluster_assignment_stale","go_goroutines","pilot_xds_pushes","pilot_proxy_convergence_time_bucket","citadel_server_root_cert_expiry_timestamp","pilot_conflict_inbound_listener","pilot_conflict_outbound_listener_http_over_current_tcp","pilot_conflict_outbound_listener_tcp_over_current_tcp","pilot_conflict_outbound_listener_tcp_over_current_http","pilot_virt_services","galley_validation_failed","pilot_services","envoy_cluster_upstream_cx_total","envoy_cluster_upstream_cx_connect_fail","envoy_cluster_upstream_cx_active","envoy_cluster_upstream_cx_rx_bytes_total","envoy_cluster_upstream_cx_tx_bytes_total","istio_request_duration_milliseconds_bucket","istio_request_duration_seconds_bucket","istio_request_bytes_bucket","istio_response_bytes_bucket"]
#measurement_prefix = ""
measurement_name = "istio_prom"
#[[inputs.prom.measurements]]
# prefix = "cpu_"
# name = "cpu"
[inputs.prom.tags]
namespace = "$NAMESPACE"
매개변수 설명
- url:Exporter 주소
- source:수집기 이름
- metric_types:지표 유형 필터
- measurement_name:수집 후 지표 집합 이름
- interval:지표 수집 주기, s 초
- $IP:와일드카드 Pod의 내부 IP
- $NAMESPACE:Pod가 속한 네임스페이스
- tags_ignore: 무시할 tag
- metric_name_filter: 유지할 지표 이름
지표¶
아래 모든 데이터 수집에는 기본적으로 host라는 전역 tag가 추가됩니다(tag 값은 DataKit가 위치한 호스트명). 또한 설정에서 [inputs.{{.InputName}}.tags]를 통해 다른 태그를 지정할 수 있습니다:
지표 상세¶
| 지표 | 설명 | 데이터 유형 | 단위 |
|---|---|---|---|
istio_agent_process_virtual_memory_bytes |
바이트 단위의 가상 메모리 크기 | int | B |
istio_agent_go_memstats_alloc_bytes |
할당되었고 여전히 사용 중인 바이트 수. | int | B |
istio_agent_go_memstats_heap_inuse_bytes |
사용 중인 힙 바이트 수. | int | B |
istio_agent_go_memstats_stack_inuse_bytes |
스택 할당자가 사용하는 바이트 수. | int | B |
istio_agent_go_memstats_last_gc_time_seconds |
마지막 가비지 컬렉션 이후 1970년부터의 초 수 | int | s |
istio_agent_go_memstats_next_gc_bytes |
다음 가비지 컬렉션이 발생할 때의 힙 바이트 수. | int | B |
istio_agent_process_cpu_seconds_total |
소비한 사용자 및 시스템 CPU 시간의 총합(초). | int | count |
istio_agent_outgoing_latency |
나가는 요청의 지연 시간(예: 토큰 교환 서버, CA 등)이며 밀리초 단위입니다. | int | count |
istio_requests_total |
요청 총수. | int | |
istio_agent_pilot_xds |
XDS를 사용하여 이 pilot에 연결된 엔드포인트 수. | int | count |
istio_agent_pilot_xds_pushes |
lds, rds, cds, eds에 대한 Pilot 빌드 및 전송 오류. | int | count |
istio_agent_pilot_xds_expired_nonce |
만료된 nonce가 있는 XDS 요청의 총수. | int | count |
istio_agent_pilot_push_triggers |
푸시가 트리거된 총 횟수이며, 푸시 사유로 라벨링됩니다. | int | count |
istio_agent_pilot_endpoint_not_ready |
준비되지 않은 상태로 발견된 엔드포인트. | int | count |
envoy_cluster_upstream_cx_total |
envoy cluster upstream cx total | int | count |
istio_agent_pilot_conflict_inbound_listener |
충돌하는 inbound listener 수 | int | count |
istio_agent_pilot_conflict_outbound_listener_http_over_current_tcp |
현재 wildcard tcp listener와 충돌하는 wildcard http listener 수 | int | count |
istio_agent_pilot_conflict_outbound_listener_tcp_over_current_tcp |
현재 tcp listener와 충돌하는 tcp listener 수 | int | count |
istio_agent_pilot_conflict_outbound_listener_tcp_over_current_http |
현재 wildcard http listener와 충돌하는 wildcard tcp listener 수 | int | count |
APM 수집¶
1 Zipkin 수집기 활성화¶
datakit.yaml을 수정하고, ConfigMap을 통해 zipkin.conf를 DataKit의 /usr/local/datakit/conf.d/zipkin/zipkin.conf 디렉터리에 마운트합니다. 아래와 같이 datakit.yaml을 수정합니다.
apiVersion: v1
kind: ConfigMap
metadata:
name: datakit-conf
namespace: datakit
data: # 아래는 추가된 부분
zipkin.conf: |-
[[inputs.zipkin]]
pathV1 = "/api/v1/spans"
pathV2 = "/api/v2/spans"
apiVersion: apps/v1
kind: DaemonSet
...
spec:
template
spec:
containers:
- env:
volumeMounts: # 아래는 추가된 부분
- mountPath: /usr/local/datakit/conf.d/zipkin/zipkin.conf
name: datakit-conf
subPath: zipkin.conf
트레이스 데이터는 zipkin.istio-system의 Service로 전송되며, 전송 포트는 9411입니다.
DataKit를 배포할 때 트레이스 지표 수집용 Zipkin 수집기는 이미 활성화되어 있습니다. DataKit 서비스의 네임스페이스는 datakit이고 포트는 9529이므로, 여기서는 변환이 필요합니다.
2 ClusterIP 서비스 정의¶
apiVersion: v1
kind: Service
metadata:
name: datakit-service-ext
namespace: datakit
spec:
selector:
app: daemonset-datakit
ports:
- protocol: TCP
port: 9411
targetPort: 9529
배포가 완료되면 클러스터 내부의 컨테이너는 datakit-service-ext.datakit.svc.cluster.local:9411을 사용해 DataKit의 9529 포트에 접근할 수 있습니다.
3 ExternalName 서비스 정의¶
apiVersion: v1
kind: Service
metadata:
name: zipkin
namespace: istio-system
spec:
type: ExternalName
externalName: datakit-service-ext.datakit.svc.cluster.local
배포가 완료되면 클러스터 내부의 컨테이너에서 zipkin.istio-system.svc.cluster.local:9411을 사용해 DataKit로 데이터를 보낼 수 있습니다.
로그¶
DataKit의 기본 설정은 컨테이너가 /dev/stdout으로 출력한 로그를 수집합니다.
더 많은 로그 수집 방법은 다음을 참고하세요.
<Kubernetes 클러스터에서 로그를 수집하는 몇 가지 방법>
베스트 프랙티스¶
베스트 프랙티스에는 Istio 설치, Istio 기본 제공 프로젝트 배포, RUM/APM 연동 등의 확장 작업이 포함되어 있습니다. 자세한 내용은 Istio 기반 마이크로서비스 관측성 구현 베스트 프랙티스를 참고하세요.