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