Azure Container Instances
Note:
This article is about Azure Container Instances (ACI), not about Azure Kubernetes Service (AKS).
To see how to use NoRouter with AKS, see Kubernetes example.
In Kubernetes example, we used kubectl exec
as the stdio connection.
However, unlike kubectl exec
, NoRouter cannot support az container exec
currently because:
- No support for stdin without tty: https://github.com/Azure/azure-cli/issues/15225
- No support for appending command arguments: https://docs.microsoft.com/en-us/azure/container-instances/container-instances-exec#restrictions
- Extra TTY escape sequence on busybox: https://github.com/Azure/azure-cli/issues/6537
A workaround is to inject an SSH sidecar into an Azure container group, and use ssh
instead of az container exec
.
SSH Sidecar
To create an Azure container group with an SSH sidecar, create a Microsoft.ContainerInstance/containerGroups
object like this:
At least, you need to set the following fields to your own values:
.properties.ipAddress.dnsNameLabel
: An arbitrary unique string. When the value is like “example” and the region is “westus”, the FQDN will be like “example.westus.azurecontainer.io”..properties.containers[?(@.name=="ssh")].environmentVariables[?(@.name=="PUBLIC_KEY")].value
: The content of~/.ssh/id_rsa.pub
See also “YAML reference: Azure Container Instances” (docs.microsoft.com
).
Save the object as nginx-with-ssh.yaml
.
Then create the container group with az container create
, and inspect the FQDN with az container show
as follows:
After the container group booted up, install NoRouter to the SSH sidecar:
NoRouter manifest can be written like this:
Make sure http://127.0.42.101:8080 is forwarded to the nginx
container inside the nginx-with-ssh
container group.