Teckadmin.files.wordpress.com



Container group

A container group is a collection of containers that get scheduled on the same host machine. The containers in a container group share a lifecycle, resources, local network, and storage volumes. It's similar in concept to a pod in Kubernetes.

------/data/appdata-------- >> myacr.azurecr.io/app:v1 :port80 >>----->>> for public accessing

VM

-----/dala/logs-------------- >> myacr.azurecr.io/sidecar:v1 : port5000

Deploy a multi-container group using a YAML file

Azure Container Instances supports the deployment of multiple containers onto a single host using a container

group. A container group is useful when building an application sidecar for logging, monitoring, or any other

configuration where a service needs a second attached process.

What will experiment here

Configure a YAML file

Deploy the container group

View the logs of the containers

Open the cloudshell from Azure portal

Configure a YAML file

To deploy a multi-container group with the az container create command in the Azure CLI, you must specify the

container group configuration in a YAML file. Then pass the YAML file as a parameter to the command.

Start by copying the following YAML into a new file named deploy-aci.yaml. In Azure Cloud Shell, you can use

Visual Studio Code to create the file in your working directory

code deploy-aci.yaml

This YAML file defines a container group named "myContainerGroup" with two containers, a public IP address,

and two exposed ports. The containers are deployed from public Microsoft images. The first container in the

group runs an internet-facing web application. The second container, the sidecar, periodically makes HTTP

requests to the web application running in the first container via the container group's local network.

Paste below code using CRTL+SHIFT+V

apiVersion: 2018-10-01

location: eastus

name: myContainerGroup

properties:

containers:

- name: aci-tutorial-app

properties:

image: mcr.azuredocs/aci-helloworld:latest

resources:

requests:

cpu: 1

memoryInGb: 1.5

ports:

- port: 80

- port: 8080

- name: aci-tutorial-sidecar

properties:

image: mcr.azuredocs/aci-tutorial-sidecar

resources:

requests:

cpu: 1

memoryInGb: 1.5

osType: Linux

ipAddress:

type: Public

ports:

- protocol: tcp

port: '80'

- protocol: tcp

port: '8080'

tags: null

type: Microsoft.ContainerInstance/containerGroups

[pic]

[pic]

Deploy the container group

az group create --name myResourceGroup --location eastus

[pic]

Deploy the container group with the az container create command, passing the YAML file as an argument

az container create --resource-group myResourceGroup --file deploy-aci.yaml

View deployment state

az container show --resource-group myResourceGroup --name myContainerGroup --output table

View container logs

az container logs --resource-group myResourceGroup --name myContainerGroup --container-name aci-tutorial-app

To see the logs for the sidecar container, run a similar command specifying the aci-tutorial-sidecar container

az container logs --resource-group myResourceGroup --name myContainerGroup --container-name aci-tutorialsidecar

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download