Implement IaaS solutions, Containers Flashcards
What is ACR Tasks
Basic Answer: Using Dockerfile and additional yaml definition files to automate the process of creation, deployment and push to azure registry. Can be used on shell, therefore good for Build Jobs as well.
From Docs:
ACR Tasks is a suite of features within Azure Container Registry that provides streamlined and efficient Docker container image builds in Azure.
What is meant by Fabric Clusters
A Service Fabric cluster is a network-connected set of virtual or physical machines into which your microservices are deployed and managed. A machine or VM that is part of a cluster is called a cluster node. Clusters can scale to thousands of nodes. If you add new nodes to the cluster, Service Fabric rebalances the service partition replicas and instances across the increased number of nodes.
How to make a container from an app and then push to Azure
1) On Dev Machine docker build to create a new image from dockerfile, use -t to tag it
2) Create container Registry when not existing (az acr create)
3) Sign into acr with az acr login
4) Tag the image within the loginServer
5) Use docker push from 4)
https: //docs.microsoft.com/en-us/azure/service-fabric/service-fabric-tutorial-create-container-images?WT.mc_id=thomasmaurer-blog-thmaure
CLI Command to Create Azure Container Registry
az acr create –resource-group –name –sku Basic –admin-enabled true
What does command ‘yo azuresfcontainer’ do?
When installed correctly, yo stands for the command line tools coming with Yeoman. Microsoft has written a generator for Yeoman that creates a service fabric application template.
What is the general process of creating a Service Fabric form an image?
1) Installing Yeoman
2) Run “yo azuresfcontainer”
3) Type in some config
4) Specify the image tag you want to use
5) Specify instance count, start with 1 usually
In Container Context, what is ServiceManifest.xml used for
Like Similar xml syntax to configure Endpoints of services within a container, like scheme and port and protocol
https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-tutorial-package-containers
In container context, what is ApplicationManifest.xml used for
In order to expose the containers in the cluster, we also need to create a port binding in the ‘ApplicationManifest.xml’. The PortBinding policy references the Endpoints we defined in the ServiceManifest.xml files. Incoming requests to these endpoints get mapped to the container ports that are opened and bounded here.
What is required to deploy a Application so that it can run as a Service Fabric?
To deploy the application to Azure, you need a Service Fabric cluster to run the application. Each instance within the cluster is called node.
Syntax to select a service cluster via shell?
Command requires Service Fabric CLI
sfctl cluster select –endpoint https://containertestcluster.eastus.cloudapp.azure.com:19080 –pem containertestcluster22019013100.pem –no-verify
What is Azure Container Instances
Basically a host for container.
From Docs:
Azure Container Instances enables deployment of Docker containers onto Azure infrastructure without provisioning any virtual machines or adopting a higher-level service.
What is meant by container replication?
Basically use an image/tag of container in different azure regions or mulitiple regions.
To copy a complete container registry:
az acr replication create –registry –location
True or false? Container Replication View can be looked up in Azure Portal
True,From within the Azure portal, selecting Replications for an Azure Container Registry displays a map that details current replications. Container images can be replicated to additional regions by selecting the regions on the map.
True of False? Container replication is possible by using the Portal and CLI?
True
Which of the following is not a benefit of using Azure Container Registry?
- Replicate container images to multiple Azure datacenters.
- Pull container images using any Docker container-related technology.
- Allow public access to container images for pull operations.
- Build container images without the need for locally installed Docker tools.
Allow public access to container images for pull operations.
Azure Container Registry is a private registry. Images cannot be accessed without authentication
What is the recommended authentication method for Azure Container Registry?
- Admin account
- Username and password
Azure service principal
No authentication
Azure service principal
Azure service principals are the recommended authentication method. They provide granular access to container images in Azure Container Registry; for example, you can specify read-only access or full access to the container registry.
Suppose you use container images to run compute workloads in multiple regions throughout the world. You plan to enable the geo-replication feature of Azure Container Registry to decrease the time required to provision an instance. In which regions should you configure the Azure Container Registry geo-replication feature?
- Place a container registry in the region closest to your development team.
- Place a container registry in each region where images are run.
- Place a container registry in every Azure region.
Place a container registry in each region where images are run.
Placing a registry in each region that runs the images will ensure network-close registry access everywhere it is needed.
In general, what is Azure Container Registry
Hosts container images, similar to Docker Hub. But only private images.
From Docs:
An Azure container registry stores and manages private Docker container images, similar to the way Docker Hub stores public Docker images. You can use the Docker command-line interface (Docker CLI) for login, push, pull, and other operations on your container registry.
How does a basic Dockerfile looks like?
Every Dockerfile must start with the FROM instruction. The idea behind is that you need a starting point to build your image. You can start FROM scratch, scratch is an explicitly empty image on the Docker store that is used to build base images like Alpine, Debian and so on. Everything else is addon, modifiny the image
FROM node:8.9.3-alpine RUN mkdir -p /usr/src/app COPY ./app/ /usr/src/app/ WORKDIR /usr/src/app RUN npm install CMD node /usr/src/app/index.js
What is an Docker alias?
A Tag
What is another Name for a Docker Tag
An Alias
What is the Syntax for creating a Docker Tag
docker tag
Required Docker Format for Pushing Tags? Specifically the naming for Tags.
[loginUrl]/[namespace]/[artifact:][tag]
What is required for a container instance to be exposed to hte internet?
A DNS Name. The DNS name must be unique.
How to specify the DNS name for a Container using CLI
–dns-name-label parameter
What are container restart policies?
Restart policies define how Containers should be restarted.
- Always (Default), good for long running tasks like web servers
- Never, containers run one time only
- OnFailure, for short tasks. Run at least once and restarted when exit code != 0
What is the initial Stauts for Containers with restart policy Never or OnFailure
Terminated
What is az container logs used for
View the logs within a container
Ho to pass arguments to a container during start
Use –environment-variables arg of command az container create
How to pass secure arguments during container start
Use –secure-environment-variables instead of –environment-variables
What are container data volumes
By default, Azure Container Instances are stateless. If the container crashes or stops, all of its state is lost. To persist state beyond the lifetime of the container, you must mount a volume from an external store.
Common Steps to create a azure storage for containers?
1) Create a storage account
2) Copy the connection string of storage account to AZURE_STORAGE_CONNECTION_STRING, using export command
3) Get Storage Key
4) Deploy Container and mount the file share using vairous –azure-file-volume- parameters for az container create command
What is AZURE_STORAGE_CONNECTION_STRING
A special azure environment variable to store connection strings, understood by Azure CLI
How to troubleshoot container instances
1) Get logs with az container logs
2) Get diagnostics with az container attach
3) Run az container exec to run programs direclty in the container, for example start /bin/sh to use ls to list folder content
What does ‘az monitor metrics list’ do?
List CPU and memory usage on your container, its required to get a CONTAINER_ID
Which restart policy is typically the best choice for long-running tasks that service requests?
Always
The restart policy Always will ensure needed processes continue to be available even if a restart is required.
True or false: by default, the values of an environment variable can be seen in the Azure portal and the Azure CLI output.
True
Which troubleshooting command can be used to view container startup events?
- az container logs
- az container attach
- az container exec
az container attach
The az container attach command shows container events and logs. By contrast, the az container logs only shows the logs and not the startup events.
What is Azure Container Instances?
Containers are becoming the preferred way to package, deploy, and manage cloud applications. Azure Container Instances offers the fastest and simplest way to run a container in Azure, without having to manage any virtual machines and without having to adopt a higher-level service.