A package for working with Azure Container Registry (ACR), Azure Kubernetes Service (AKS) and Azure Container Instances (ACI). Extends the Azure Resource Manager interface provided by the AzureRMR package.

AzureContainers lets you build and deploy containerised services in R, using Docker and Kubernetes. For full functionality, you should have Docker installed, as well as the kubectl and helm commandline tools. Otherwise it is relatively lightweight, requiring neither Powershell nor Python.

Note that AzureContainers can talk to any Docker registry that uses the V2 HTTP API, not just those created via ACR. Similarly, it can interface with Kubernetes clusters anywhere, not just those created via AKS.

Example workflow

Here is a sample R workflow to package up an R model as a container, deploy it to a Kubernetes cluster, and expose it as a service.

# login to Azure ---
az <- AzureRMR::az_rm$new("<tenant_id>", "<app_id>", "<secret>")
resgroup <- az$
    create_resource_group("myresgroup", location="australiaeast")

# create container registry ---
acr <- resgroup$create_acr("myacr", location="australiaeast")

# create Docker image from a predefined Dockerfile ---
call_docker("build -t newcontainer .")

# get registry endpoint, upload image ---
reg <- acr$get_docker_registry()

# create Kubernetes cluster with 2 nodes ---
aks <- resgroup$create_aks("myakscluster",
    agent_pools=aks_pools("pool1", 2, "Standard_DS2_v2", "Linux"))

# get cluster endpoint, deploy from ACR to AKS with predefined yaml definition file ---
clus <- aks$get_cluster()
clus$create_registry_secret(reg, email="")

cloudyr project logo