Kubernetes에서 Python용 App and API Protection 설정
You can enable App and API Protection for Python services with the following setup options:
- If your Python service already has APM tracing set up and running, then skip to service configuration
- If your Python service doesn't have APM tracing set up, you can easily enable App and API Protection with Datadog's Automatic Installation
- Otherwise, keep reading the following manual setup instructions
Overview
App and API Protection leverages the Datadog Python library to monitor and secure your Python service. The library integrates seamlessly with your existing application without requiring code changes.
For detailed compatibility information, including supported Python versions, frameworks, and deployment environments, see Python Compatibility Requirements.
This guide explains how to set up App and API Protection (AAP) for Python applications. The setup involves:
- Installing the Datadog Agent
- Enabling App and API Protection monitoring
- Running your Python application with the Datadog Agent
- Verifying the setup
전제 조건
- Kubernetes 클러스터
- Docker로 컨테이너화된 Python 애플리케이션
- 클러스터에 액세스하도록 구성된 kubectl
- Helm(Agent 설치 권장)
- Datadog API 키
- Datadog Python SDK(버전 요구 사항 참조)
1. Datadog Agent 설치
Kubernetes 설정 지침에 따라 Datadog Agent를 설치합니다.
2. App and API Protection 모니터링 활성화
Automatically enabling App and API Protection through Remote Configuration
You can enable services with remote configuration on your services dashboard.
Check the box for the service you want to enable App and API Protection for under Activate on your APM services.
App and API Protection 모니터링 수동 활성화
init 컨테이너를 사용하거나 애플리케이션의 Dockerfile에서 Datadog Python SDK를 설치합니다.
Datadog을 통해 서비스를 구성하고 실행합니다.
환경 변수를 사용하여 App and API Protection을 활성화한 상태에서 Python 애플리케이션을 시작합니다.
apiVersion: apps/v1
kind: Deployment
metadata:
name: your-python-app
spec:
template:
spec:
containers:
- name: your-python-app
image: your-python-app-image
env:
- name: DD_APPSEC_ENABLED
value: "true"
- name: DD_SERVICE
value: "<MY_SERVICE>"
- name: DD_ENV
value: "<MY_ENV>"
command: ["ddtrace-run", "python", "app.py"]
App and API Protection을 활성화한 상태에서 APM 추적을 비활성화하려면 APM 추적 변수를 ‘false’로 설정해야 합니다.
환경 변수를 사용하여 App and API Protection을 활성화한 상태에서 Python 애플리케이션을 시작합니다.
apiVersion: apps/v1
kind: Deployment
metadata:
name: your-python-app
spec:
template:
spec:
containers:
- name: your-python-app
image: your-python-app-image
env:
- name: DD_APPSEC_ENABLED
value: "true"
- name: DD_APM_TRACING_ENABLED
value: "false"
- name: DD_SERVICE
value: "<MY_SERVICE>"
- name: DD_ENV
value: "<MY_ENV>"
command: ["ddtrace-run", "python", "app.py"]
3. 애플리케이션 실행
업데이트된 배포를 적용합니다.
kubectl apply -f your-deployment.yaml
4. Verify setup
To verify that App and API Protection is working correctly:
- Send some traffic to your application
- Check the Application Signals Explorer in Datadog
- Look for security signals and vulnerabilities
문제 해결
Python 애플리케이션에 App and API Protection을 설정하는 과정에서 문제가 발생할 경우, Python App and API Protection 문제 해결 가이드를 참조하세요.
추가 자료