Code Monkey home page Code Monkey logo

itt-apps40's Introduction

APPS40: Consolidating Infrastructure with Azure Kubernetes Service

Learning Path

Session Abstract

Kubernetes is the open source container orchestration system that supercharges applications with scaling and reliability and unlocks advanced features, like A/B testing, Blue/Green deployments, canary builds, and dead-simple rollbacks.

In this session, you’ll see how Tailwind Traders took a containerized application and deployed it to Azure Kubernetes Service (AKS). You’ll walk away with a deep understanding of major Kubernetes concepts and how to put it all to use with industry standard tooling.

Table of Content

Resources Links
PowerPoint - Presentation
Videos - Dry Run Rehearsal
- Microsoft Ignite Orlando Recording
Demos - Demo 1 - Scale Demo
- Demo 2 - Network policy
- Demo 3 - Availability Zones

Regions this code will work with

  • East US 2​
  • North Europe​
  • Southeast Asia​
  • West Europe​
  • West US 2

In order to deploy this template, you need an Azure Service Principal. If needed, use the az ad sp create-for-rbac command to create the service principal. See az ad sp create-for-rbac for more information.

Provider registration

The Tailwind Traders application uses many Azure services. In some cases, if a service has not yet been used in your subscription, a provider registration may be needed. The following commands will ensure your subscription is capable of running the Tailwind Traders application.

az provider register --namespace Microsoft.OperationalInsights
az provider register --namespace Microsoft.Network
az provider register --namespace Microsoft.DocumentDB
az provider register --namespace Microsoft.DBforPostgreSQL
az provider register --namespace Microsoft.OperationsManagement
az provider register --namespace Microsoft.ContainerService
az provider register --namespace Microsoft.Sql
az provider register --namespace Microsoft.ContainerRegistry
az provider register --namespace Microsoft.insights
az feature register --name AvailabilityZonePreview --namespace Microsoft.ContainerService
az feature register --name AKSAzureStandardLoadBalancer --namespace Microsoft.ContainerService
az feature register --name VMSSPreview --namespace Microsoft.ContainerService

Then refresh you account with

az provider register --namespace Microsoft.ContainerService

You will also need kubectl version 1.14.6

Connect to deployment

To validate that the deployment has completed, select the Azure Container Instance.

alt text

Select Containers. Once the container state has changed from Running to Terminated, the deployment automation has completed.

alt text

Scroll to the bottom of the logs to retrieve both the application URL and the command needed to connect to the Kubernetes cluster.

alt text

Running scale demo

💡 You must have completed the deployment before attempting to do the demo.

To run the scaling demo you need to add the publisher

cat <<EOF | kubectl apply -f -
apiVersion: batch/v1
kind: Job
metadata:
  name: rabbitmq-publish
spec:
  template:
    spec:
      containers:
      - name: rabbitmq-client
        image: jeffhollan/rabbitmq-client:dev
        imagePullPolicy: Always
        command: ["send",  "amqp://user:[email protected]:5672", "300"]
      restartPolicy: Never
  backoffLimit: 4
EOF

In two new terminals you need to have the following commands running to watch the results.

kubectl get hpa -w

alt text

In the image above you can see that the application is scaling using the metrics from the horizontal pod autoscaler

kubectl get pods -o wide -w

alt text

In the image above you can see that we are scaling the pods to virtual node on ACI dynamically.

To cleanup the scaling demo use the following

cat <<EOF | kubectl delete -f -
apiVersion: batch/v1
kind: Job
metadata:
  name: rabbitmq-publish
spec:
  template:
    spec:
      containers:
      - name: rabbitmq-client
        image: jeffhollan/rabbitmq-client:dev
        imagePullPolicy: Always
        command: ["send",  "amqp://user:[email protected]:5672", "300"]
      restartPolicy: Never
  backoffLimit: 4
EOF

Network policy

💡 You must have completed the deployment before attempting to do the demo.

For the networking policy demo we will need to open two terminals. The first we will pretend to be a rouge service in the default namespace. The second we will apply the network policy.

In the first terminal issue the following commands

kubectl run --rm -it --image=alpine network-policy  --generator=run-pod/v1

Once you have the shell inside the cluster issue

wget http://stock.twt

Now exit this terminal with exit.

This will show that we are able to hit backend services in twt from any namespace as the network by default is flat. Now in the second terminal we need to apply a network policy that will not allow any traffic from outside the twt namespace to hit it.

cat <<EOF | kubectl apply -f -
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
  name: twt-policy
  namespace: twt
spec:
  podSelector: {}
  ingress:
  - from:
    - namespaceSelector:
        matchLabels:
          purpose: prod-app
      podSelector:
        matchLabels:
          role: twt-app
EOF

now in the first terminal enter

kubectl run --rm -it --image=alpine network-policy  --generator=run-pod/v1

Once you have the shell enter

wget --timeout=2 http://stock.twt

The connection should be blocked. Exit the terminal with exit

Now cleanup

cat <<EOF | kubectl delete -f -
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
  name: twt-policy
  namespace: twt
spec:
  podSelector: {}
  ingress:
  - from:
    - namespaceSelector:
        matchLabels:
          purpose: prod-app
      podSelector:
        matchLabels:
          role: twt-ap
EOF

Availability zones

💡 You must have completed the deployment before attempting to do the demo.

This is set up by the deployment.json To test this is set up correctly use the following command

kubectl describe nodes | grep -e "Name:" -e "failure-domain.beta.kubernetes.io/zone"

The output should look like

Name:               aks-agentpool-12493275-vmss000000
                    failure-domain.beta.kubernetes.io/zone=southeastasia-1
Name:               aks-agentpool-12493275-vmss000001
                    failure-domain.beta.kubernetes.io/zone=southeastasia-2
Name:               aks-agentpool-12493275-vmss000002
                    failure-domain.beta.kubernetes.io/zone=southeastasia-3
Name:               virtual-node-aci-linux

Delete your deployment

To delete the deployment run the following:

az group delete -n < your resource group> -y

How To Use

Welcome, Presenter!

We're glad you are here and look forward to your delivery of this amazing content. As an experienced presenter, we know you know HOW to present so this guide will focus on WHAT you need to present. It will provide you a full run-through of the presentation created by the presentation design team.

Along with the video of the presentation, this document will link to all the assets you need to successfully present including PowerPoint slides and demo instructions & code.

  1. Read document in its entirety.
  2. Watch the video presentation
  3. Ask questions of the Lead Presenter

Assets in Train-The-Trainer kit

Become a Trained Presenter

To become a trained presenter, contact [email protected]. In your email please include:

  • Complete name:
  • The code of this presentation: apps40
  • Link (ex: unlisted YouTube video) to a video of you presenting (~10 minutes).

    It doesn't need to be this content, the important is to show your presenter skills

A mentor will get back to you with the information on the process.

Trained Presenters

Thanks goes to these wonderful people (emoji key):

Scott Coulton
Scott Coulton

📢 📖

itt-apps40's People

Contributors

jldeen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.