Skip to content

This demo shows how to mount configuration files as secrets in Azure Container Apps using volume mounts. This allows for configuration files to be loaded into the container from the host machine (like a ConfigMap)

License

Notifications You must be signed in to change notification settings

kewalaka/aca-configmount

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mounting Secret Volumes in Azure Container Apps

This demo shows how to mount configuration files as secrets in Azure Container Apps using volume mounts.

This allows for configuration files to be loaded into the container from the host machine (like a ConfigMap)

Overview

The example:

  • Creates an Azure Container App running nginx:alpine
  • Injects an nginx configuration file from this repo nginx.conf

Key Components

Secret Configuration

The nginx configuration is loaded from nginx.conf and stored as a secret named nginx-config-content:

secrets = [
  {
    name  = "nginx-config-content"
    value = file("${path.module}/nginx.conf")
  }
]

Volume Mount

This "secret" is mounted as a volume in the container:

volumeMounts = [
  {
    volumeName = "nginx-config"
    mountPath  = "/etc/nginx/conf.d"
  }
]

volumes = [
  {
    name        = "nginx-config"
    storageType = "Secret"
    secrets = [
      {
        secretRef = "nginx-config-content"
        path      = "default.conf"
      }
    ]
  }
]

Usage

  1. Deploy the infrastructure:
terraform init
terraform plan
terraform apply
  1. Access the application using the output URL to verify the nginx configuration is loaded correctly.

Result

alt text

alt text

About

This demo shows how to mount configuration files as secrets in Azure Container Apps using volume mounts. This allows for configuration files to be loaded into the container from the host machine (like a ConfigMap)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages