微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

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

我开始使用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","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,"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",}],

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。