使用 Pulumi 将卷和文件添加到 Azure 中的容器

Add volumes and files to a container in Azure using Pulumi

我开始使用 Pulumi 在 Azure 云中部署容器。 目前我遇到了问题,因为我需要将一些配置文件加载到 Traefik 的容器中,但我找不到正确的方法。这个想法是 Traefik 作为组中其他容器的反向代理。

我的问题是,无论我如何指定卷的创建并尝试将其连接到容器,当我转到 Azure 仪表板时,容器似乎没有任何连接的卷。

import pulumi
import pulumi_azure_nextgen as azure

data_rg = azure.resources.latest.ResourceGroup(
       "data-rg",
       resource_group_name="data-rg",
       location="West Europe")
datahike_group = azure.containerinstance.latest.ContainerGroup(
        "data-group",
        location="West Europe",
        container_group_name="data-cg",
        resource_group_name=data_rg.name,
        containers=[{
                    "name":"data",
                    "image": "wordpress:latest",
                    "resources": {
                        "requests": { "cpu": 0.5, "memory_in_gb": 1.5}
                    },
                },
                {
                    "name": "proxy",
                    "image": "traefik:latest",
                    "resources": {
                        "requests": { "cpu": 0.5, "memory_in_gb": 1.5}
                    },
                    "ports": [{
                        "port": 80,
                        "protocol": "TCP",
                        }],
                    "VolumeMount": [{
                        "mount_path": "/etc/traefik/config_base.yml",
                        "name": "traefik-volume",
                    }],
                    "environment_variables": [{
                        "name": "TRAEFIK_CONFIG_FILE",
                        "value": "file"
                        },{
                        "name": "TRAEFIK_CONFIG_PATH",
                        "value": "/etc/traefik/config_base.yml"
                        }
                    ],                    
                },        
        ],
        ip_address={
            "dnsNameLabel": "dnsnamelabel1",
            "ports": [{
                "port": 80,
                "protocol": "TCP",
            }],
            "type": "Public",
        },
        volumes=[
            {
                "emptyDir": {},
                "name": "datahike-volume",
            },
            {
                "name": "traefik-volume",
                "secret": {
                    "secretKey1": "SecretValue1InBase64",
                },
            },            
        ],
        os_type="Linux",
        tags={
            "environment": "testing",
        })

pulumi.export("data_ip", data_group.ip_address)

有谁知道为什么会失败?

在这种情况下,错误是由于拼写错误造成的:

"volumeMounts": [{
    "mount_path": "/etc/traefik/config_base.yml",
    "name": "traefik-volume",
}],