Skip to content
Scripted Docker image deployment in Azure Kubernets Services
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
0-variables.ps1
README.md
azure-create-container-registry.ps1
azure-create-kubernetes-cluster.ps1
azure-create-resourcegroup.ps1
azure-set-permissions.ps1
docker-push-image.ps1
docker-tag-image.ps1
kubectl-deployment.ps1
kubernetes-apply-manifest.ps1
kubernetes-get-service-ip.ps1
kubernetes-manifest-template.yaml
kubernetes-manifest-transform.ps1
kubernetes-view-dashboard.ps1
setup-remove-resourcegroup.ps1
setup-run-all.ps1

README.md

Dibbus.Math.Azure.K8S

Scripted Docker image deployment in Azure Kubernets Services

Setup

In order to run a Docker image in Azure Kubernetes Services you'll need:

  1. An Azure Resourcegroup
  2. An Azure Kubernetes cluster
  3. An Azure container registry
  4. Kubernetes permissions to pull from the registry
  5. A docker image (duh!)
  6. A service manifest
  7. A deployment manifest
  8. A configmap (optional)

Settings

Add a settings.json file using this format with the correct settings:

settings.json

{
   "resourceGroup": {
      "location": "westeurope",
      "name": "[name of the Azure resource group]"
   },
   "docker": {
      "image": {
         "name": "[name of the docker image]",
         "tag": "[name of the docker tag]"
      }
   },
   "kubernetes": {
      "cluster": {
         "name": "[name of the kubernetes cluster]",
         "size": "Standard_B2s",
         "nodes": 1
      },
      "namespace": "[preferred namespace]]",
      "application": {
         "name" :"[name of yout application]"
      }
   },
   "containerregistry": {
      "name":"[name of the container registry]",
      "suffix":"azurecr.io"
   }
}

Kubernetes manifest files

The Kubernetes deployment requires additional manifest files which are responsible for designing the 'Desired State'.

This repo contains a simple transform script to find/replace the values from the settings file. This scripts takes the template file file and injects the values from the settings.json. The result is renamed to 'kubernetes-manifest.yaml' which is referenced in the deployment script.

Start

You can run the setup-run-all.ps1 script to start the setup.

Duration of this installation

This whoel setup, using a small Docker images takes around 10 minutes to setup. Most of the time is consumed by settings up the Kubernetes cluster:

15:54 > Creating Resourcegroup: [name of resourcegroup] in [location]
15:54 > Creating Kubernetes Cluster: [name of cluster] in: [name of resourcegroup] in [location]
15:54 > Resourcegroup: [name of resourcegroup]
15:54 > Location: [location]
15:54 > VM size: [vmsize]
15:54 > Number of nodes: [number of nodes]
16:01 > Creating Container Registry: [name of container registry]
16:01 > Resourcegroup: [name of resourcegroup]
16:02 > Settings permissions in ACR so AKS has the correct permission to pull images from the registry
16:02 > Getting assignee (AKS)
16:02 > Service Principal ClientID: [GUID]
16:02 > Getting scope
16:02 > Container Registry Resource ID: [full path of the container registry]
16:02 > Assign role on the registry
16:02 > Tag Docker image
16:02 > Pusing Docker image to ACR
16:04 > Transforming manifest template
16:04 > Creating Kubernetes Namespace
16:04 > Apply manifest files
16:04 > Opening Dashboard
You can’t perform that action at this time.