Kubernetes で Python 向けの App and API Protection をセットアップしてください。
This product is not supported for your selected
Datadog site. (
).
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 (Datadog 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 トラブルシューティングガイドを参照してください。
参考資料