How to deploy into a Service Fabric cluster using CLI - azure

I want to deploy a container image onto Service Fabric cluster running on Azure. I have already pushed image on Azure Container Registry. Using command line interface, how can I deploy container image into Service Fabric Cluster running on Azure?
I looked at sfctl command but could not find anything helpful.

An easy way to do this is by using sfctl compose create.
With this command you deploy a container to the cluster by using a docker-compose file.
Getting started...

Related

How to pass Dockerfile or docker-compose in Azure Portal?

I saw that you can run containers using your own Dockerfile or docker-compose by executing Azure CLI.
But is it possible to specify a Dockerfile or dockercompose which will contain a link to the image and also some variables for the run-tim but through the Azure Portal and not Azure CLI?
I am referring to ACI type of containers.
Thanks
you can built the docker container locally or with a CI/CD pipeline and upload it to a container registry (Azure CR or Docker hub).
when creating an Azure Container Instance you can retrieve it from this repository

How do I run a dockerized 'Hello World' web job deployed into Virtual Kubelet within Azure Kubernetes Service (AKS)

I did create a simple 'Hello World' Web Job and placed that Web Job inside a Docker Windows Container/Nanoserver
I did push that Docker Windows Container into an Azure Container Registry
I did follow this article and successfully created Virtual AKS pods/nodes
When I run 'get pods' I do see the pods created and running
I do see IP's generated reflected in the 'get pods' command
My question is how do I run the container inside these pods/nodes?
I did try to reference the IP's but those IP's don't load anything
How can I run those containers that I successfully placed into Virtual Kubelet pods/nodes
If the containers in the get fired up by themselves, do they fire up/get invoked only once or every n number of minutes?
Is there a way to check on how the last run went, like log files?
Thank you very much for your help
First of all, I see you create your web job inside a Windows-based Docker. If so, you cannot run the container in the AKS while it does not support Windows nodes, at least current. For window container, I suggest you could use the Azure Container Instance or Web App for Container.
For Linux containers, the pod in AKS is a group of one or more containers (such as Docker containers), with shared storage/network, and a specification for how to run the containers. If you already have the Docker image, you can create the container inside the pod follow the steps in Running the application in AKS.
In addition, you can set the restart policy for your container. See Restart Policy for the container in Kubernetes. For the logs, I suggest you could use the persist volumes. If not, the files will be lost if the container crash.\
Update
If you really want to run windows container in AKS cluster, there is also a way for you. You can use the virtual Kubelet and Azure Container Instance in AKS. Follow the steps Run Windows container in AKS.

Docker swarm deploy to Azure

I have problem with Azure - i am missing Docker for azure CE in Microsoft Azure Marketplace. By this tutorial
https://docs.docker.com/docker-cloud/cloud-swarm/link-azure-swarm/#enable-your-azure-subscription-for-docker-cloud
it was there.
I followed the tutorial and i have local swarm running on my OS (which is Ubuntu). How can i deploy my local swarm to Azure some other way?
I cannot continue the tutorial.
Docker Cloud is shutting down in a few weeks, so I don't recommend using it or its custom OS builds. It's quite easy to build a Swarm with the "Docker for Azure" template, or by scratch by just creating Azure resources yourself and installing Docker on Ubuntu.

Run docker container on azure

I have a simple docker container which runs just fine on my local machine. I was hoping to find an easy checklist how I could publish and run my docker container on Azure, but couldn't find one. I only found https://docs.docker.com/docker-for-azure/, but this document kind of leaves me alone when it comes to actually copy my local docker container to Azure. Isn't that supposed to be very easy? Can anybody point me in the right direction how to do this?
But it is really easy.. once you know where to find the docs :-). I would take the azure docs as a starting point as there are multiple options when it comes to hosting containers in Azure:
If you're looking for this...
Simplify the deployment, management, and operations of Kubernetes -> Azure Container Service (AKS)
Easily run containers on Azure with a single command -> Container Instances
Store and manage container images across all types of Azure deployments
-> Container Registry
Develop microservices and orchestrate containers on Windows or Linux
-> Service Fabric
Deploy web applications on Linux using containers
-> App Service
Based on your info I would suggest storing the image using the Azure Container Registry and host the container using Azure Container Instances. No need for a VM to manage this way.
There is an excellent tutorial you could follow (I skipped the first 1 step since it involves creating a docker image, you already have one)
Another complete guide of pushing your image to azure and create a running container can be found here.
The good thing about Azure Container Instances is that you only pay for what you actually use. The Azure Container Registry is a private image repository hosted in Azure, if course you could also use Docker Hub but using ACR makes it all really simple.
In order to run an image, you simply need to configure a new VM with the Docker Daemon. I personally found Azure's documentation to be pretty complex. Assuming you are not trying to scale your service across instances, I would recommend using docker-machine rather than the Azure guide.
docker-machine is a CLI tool published by the Docker team which automatically installs the Docker Daemon (and all the dependencies) on a host. So all you would need to do is input your Azure subscription and it will automatically create a VM configured appropriately.
In terms of publishing the image, Azure is probably not the right solution. I would recommend one of two things:
Use Docker Hub, which serves as a free hosted Docker image repository. You can simply push images to Docker Hub (or even have them built directly from your Git repository).
Configure a CD tool, such as TravisCI or CircleCI, and use these to build your image and push directly to your deployment.
To run your docker image inside ACI, You can use of Azure Container Registry.
Step0: Create Azure Container Registry
Step1: Include a Dockerfile in your application code
Step2: Build the code along with the Dockerfile with a tag and create a
Docker image ( docker build -t imagename:tag .)
Step3: Push the Docker image to Azure container Registry with a image name and tag.
Step4: Now create a ACI, while creating, choose the image type as private, provide the image name, tag, image registry login server, image registry username, image registry password ( these details can be found under access keys tab inside Azure Container Registry)
Step5: choose running os as linux, in network step you can give an dns name for your ACI, then click on review & create
Step6: once ACI gets created you can go to overview and you can see fqdn, using fqdn you can access your application running inside Azure Container Instance.

AKS: CI/CD pipeline using AKS

I'm trying to figure out the steps to setup CI/CD for an Asp.Net Core web application using AKS with VSTS. Are the steps described in https://learn.microsoft.com/en-us/vsts/build-release/apps/cd/azure/deploy-container-kubernetes valid for what I'm trying to do? Are windows container supported in AKS?
If your application is in ASP.Net Core, then you can host it in Linux as your code is platform independent. I have done this using Docker-file where your container is a self hosted app running on AKS.
VSTS provides a Inbuilt task to deploy to your AKS cluster in your build pipeline.
Windows support on k8s is better with Windows Server version 1709 which needs Kubernetes v1.9 (bleeding edge stable). See https://kubernetes.io/docs/getting-started-guides/windows/
Unfortunately, at this time, AKS preview only supports up to 1.8.2.
Frosty, if you can create a docker image out of your Windows machine, it can be pushed to the container registry and then deployed to Kubernetes cluster. Here are some links for reference:
Building and Pushing Windows container images: https://blog.docker.com/2016/09/build-your-first-docker-windows-server-container/
Install Azure CLI: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest
Create Kubernetes cluster in AKS: https://coderise.io/kubernetes-cluster-on-azure-container-service/
Windows containers are in private preview in AKS (reference); you can sign up using this form.. You can run hybrid clusters (Linux+Windows, up to 1803) using acs-engine today.
The VSTS walkthrough you linked is valid; check also this one and this one.
Update: Windows support for AKS is still a work in progress.
Currently Windows container are only in private preview, and you need to enable it using Azure CLI do some steps, please refer this official docs: https://learn.microsoft.com/en-us/azure/aks/windows-container-cli. After you enable it, then you can check the 'Windows Container' option when you create node pool in your azure kubernete service account.

Resources