最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Debug Azure Container Apps - Stack Overflow

programmeradmin5浏览0评论

I'm having a hard time to debug my container on Azure Container Apps. Before, I had a K8S cluster, where I could query my pod with kubectl and find quite easily the reason why the container was not starting, or failed to run after starting.

Here on ACA, I feel lost. I have nothing in my "Log Stream" on System nor Console. In normal Log, I don't have the table ContainerAppSystemLogs_CL where most of people debug their app.

I only have access to ContainerAppSystemLogs and the only info I have inside it is:

Successfully pulled image 'artifacts.xxxxxxxxxx.xxx/xxxxxxx/xxxxx:xxxxxx' in 65.1182032s
Created container 'XXX'
Started container 'XXX'
Probe of StartUp failed with status code: 1 # For 10 minutes and more than 300 counts
Deactivated apps/v1.Deployment k8se-apps/XXX-sandbox--8tmx1eh from 1 to 0
Container 'XXX' was terminated with exit code '' and reason 'ManuallyStopped'

My auto scaller is an http scaller from 0 to 1, that's why it is stopping. But it's not "ManuallyStopped", it's from the scale rule.

I removed Probes (liveness and health) for better debugging, but it does not help. My container is made for sandboxing. So it's a basic image with entrypoint a "while true; do sleep 10000; done". Because I want to connect to it, and test flows and code direclty inside a container.

I have no idea where to look to find a lead to debug this.

Here is what the JSON template of my ressource looks like:

{
    "id": "/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.App/containerapps/{containerapp-name}",
    "name": "{containerapp-name}",
    "type": "Microsoft.App/containerApps",
    "location": "West Europe",
    "systemData": {
        "createdBy": "{creator-id}",
        "createdByType": "Application",
        "createdAt": "2025-02-20T16:16:20.6526066",
        "lastModifiedBy": "{modifier-id}",
        "lastModifiedByType": "Application",
        "lastModifiedAt": "2025-03-07T14:38:58.4834247"
    },
    "properties": {
        "provisioningState": "Succeeded",
        "runningStatus": "Running",
        "managedEnvironmentId": "/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.App/managedEnvironments/{environment-name}",
        "environmentId": "/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.App/managedEnvironments/{environment-name}",
        "workloadProfileName": "Consumption",
        "patchingMode": "Automatic",
        "outboundIpAddresses": null,
        "latestRevisionName": "{containerapp-name}--revision1",
        "latestReadyRevisionName": "{containerapp-name}--revision2",
        "latestRevisionFqdn": "{containerapp-name}.azurecontainerapps.io",
        "customDomainVerificationId": "{verification-id}",
        "configuration": {
            "secrets": [
                {
                    "name": "secret1"
                },
                {
                    "name": "secret2"
                },
                {
                    "name": "secret3"
                }
            ],
            "activeRevisionsMode": "Single",
            "ingress": {
                "fqdn": "{containerapp-name}.azurecontainerapps.io",
                "external": true,
                "targetPort": 8443,
                "exposedPort": 0,
                "transport": "Auto",
                "traffic": [
                    {
                        "weight": 100,
                        "latestRevision": true
                    }
                ],
                "customDomains": [
                    {
                        "name": "custom-domain1",
                        "certificateId": "/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.App/managedEnvironments/{environment-name}/certificates/{certificate-name}",
                        "bindingType": "SniEnabled"
                    },
                    {
                        "name": "custom-domain2",
                        "certificateId": "/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.App/managedEnvironments/{environment-name}/certificates/{certificate-name}",
                        "bindingType": "SniEnabled"
                    }
                ],
                "allowInsecure": false,
                "ipSecurityRestrictions": null,
                "corsPolicy": null,
                "clientCertificateMode": "Ignore",
                "stickySessions": {
                    "affinity": "none"
                }
            },
            "registries": [
                {
                    "server": "registry-server",
                    "username": "{registry-username}",
                    "passwordSecretRef": "secret1",
                    "identity": ""
                }
            ],
            "identitySettings": [],
            "dapr": {
                "enabled": false,
                "appId": null,
                "appProtocol": "http",
                "appPort": null,
                "httpReadBufferSize": null,
                "httpMaxRequestSize": null,
                "logLevel": "info",
                "enableApiLogging": false
            },
            "runtime": null,
            "maxInactiveRevisions": 10,
            "service": null
        },
        "template": {
            "revisionSuffix": "",
            "terminationGracePeriodSeconds": 120,
            "containers": [
                {
                    "image": "registry-server/{image-name}:latest",
                    "imageType": "ContainerImage",
                    "name": "{container-name}",
                    "env": [
                        {
                            "name": "CLIENT_AUTH_CERT_PATH",
                            "value": "/certs/{cert-name}"
                        },
                        {
                            "name": "CA_ROOT_PATH",
                            "value": "/certs/{ca-bundle-name}"
                        },
                        {
                            "name": "GUNICORN_NB_WORKERS",
                            "value": "1"
                        },
                        {
                            "name": "GUNICORN_TIMEOUT",
                            "value": "180"
                        },
                        {
                            "name": "GUNICORN_WORKER_CLASS",
                            "value": "sync"
                        },
                        {
                            "name": "WSGI_API_PACKAGE_PATH",
                            "value": "datalab_api/wsgi"
                        },
                        {
                            "name": "APP_LOG_FILE_NAME",
                            "value": "gunicorn_api_None_app.log"
                        },
                        {
                            "name": "ACCESS_LOG_FILE_NAME",
                            "value": "gunicorn_api_None_access.log"
                        },
                        {
                            "name": "ERROR_LOG_FILE_NAME",
                            "value": "gunicorn_api_None_error.log"
                        },
                        {
                            "name": "DJANGO_APPLICATION",
                            "value": "None"
                        },
                        {
                            "name": "DEPLOY_ENV",
                            "value": "dev"
                        },
                        {
                            "name": "DATABASE_USED",
                            "value": "false"
                        },
                        {
                            "name": "DATABASE_ENGINE",
                            "value": "django.db.backends.sqlite3"
                        },
                        {
                            "name": "DATABASE_HOST",
                            "value": "none"
                        },
                        {
                            "name": "DATABASE_PORT",
                            "value": "3306"
                        },
                        {
                            "name": "DATABASE_NAME",
                            "value": "None_dev"
                        },
                        {
                            "name": "DATABASE_USER",
                            "secretRef": "secret2"
                        },
                        {
                            "name": "DATABASE_PASSWORD",
                            "secretRef": "secret3"
                        }
                    ],
                    "resources": {
                        "cpu": 0.25,
                        "memory": "0.5Gi",
                        "ephemeralStorage": "1Gi"
                    },
                    "volumeMounts": [
                        {
                            "volumeName": "cert-volume",
                            "mountPath": "/certs/"
                        }
                    ]
                }
            ],
            "scale": {
                "minReplicas": 0,
                "maxReplicas": 1,
                "rules": [
                    {
                        "name": "http-scale-rule",
                        "http": {
                            "metadata": {
                                "concurrentRequests": "20"
                            }
                        }
                    }
                ]
            },
            "volumes": [
                {
                    "name": "cert-volume",
                    "storageType": "Secret",
                    "secrets": [
                        {
                            "secretRef": "secret4",
                            "path": "{cert-name}"
                        },
                        {
                            "secretRef": "secret5",
                            "path": "{ca-bundle-name}"
                        }
                    ]
                }
            ]
        },
        "eventStreamEndpoint": "/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/containerApps/{containerapp-name}/eventstream",
        "delegatedIdentities": []
    },
    "identity": {
        "type": "SystemAssigned",
        "principalId": "{principal-id}",
        "tenantId": "{tenant-id}"
    },
    "apiVersion": "2024-02-02-preview"
}
发布评论

评论列表(0)

  1. 暂无评论