Azure Monitor For Containers
Monitors the performance of containers deployed to several platforms. You can monitor below:
Azure Kubernetes Service (AKS)
Self-managed K8 cluster hosted on Azure using AKS Engine
Azure Container Instances
Self-managed K8 clusters hosted on Azure Stack or on-premises
Azure Red Hat OpenShift
Azure Arc enabled Kubernetes
Implementing Azure Monitor for Kubernetes
Let’s create and deploy a docker container to AKS. Source code for azure app insight for docker container.
Creating MVC application with docker
First create MVC asp.net project select docker Linux support.
Run project locally
Package this app in container and deploy into container registry
You can use Docker hub or Azure Container Registry
Creating Azure Container Registry
Next I am going to use Azure Container Registry Service to create new container registry.
Under repository of my container registry My MVC application docker image will appear.
Visual Studio will package my app into a docker image and deploy to my azure docker container registry.
Once my docker image any docker host like Azure Container Instances or Azure Kubernetes Service (AKS).
Publishing Asp.net Docker Image to Azure
Right click application and publish
Select Docker Container Registry
Next select azure container registry
Select your resource group and azure container registry to publish then select publish. It will take some time to publish your image to Azure Container Registry.
What is the meaning of word Kubernetes?
The name “Kubernetes” stems from an ancient Greek word for “helmsman,” (someone who steers a ship, like a container ship) which explains the ship wheel logo.
Creating Kubernetes Cluster in Azure
Kubernetes Cluster concepts
Azure Container Registry has Docker Image and in order to connect to your own docker container image you will get container name and registry name that will help you to host your docker image to any Azure container hosting services.
Azure Kubernetes Cluster host the docker container and exposes the container into public 8080 port using in-built high performance load balancer.
You need pod workflow from Kubernetes Cluster which will connect to the container registry using container name and registry name and create internal 80 port for your app.
Next you need service to expose internal port 80 to public 8080 over load balancer.
While creating Kubernetes Cluster remember 3 things.
Authentication method : required to connect Azure Container Registry to get the docker image.
Integration : Which Container Registry to select your own Container Registry that is we created where we have our docker image.
You can check the performance of your container by going to the Monitor Insights. Once our container will be deployed to the Kubernetes then we can observe performance.
Here is the YML for creating POD in k8 cluster.
apiVersion: v1
kind: Pod
metadata:
name: insights-demo01 # give any name
labels:
app: insights-demo01 # app name
component: netcore-app
spec:
containers: # which container u want to deploy
- image: regdemo01.azurecr.io/appcontainerinsightsdemo:latest # <NameOfTheContainerRegistry>/<NAMEofTheDockerContainer>:latest
name: webapi
ports:
- containerPort: 80
YML for creating service in K8 cluster.
apiVersion: v1
kind: Service
metadata:
labels:
app: insights-demo01 # give any name
name: insights-demo01 # give any name
spec:
ports:
- port: 8080 # public port
protocol: TCP
targetPort: 80 # internal port
selector:
app: insights-demo01
component: netcore-app
type: LoadBalancer
Comments