GithubHelp home page GithubHelp logo

r4rohan / python-app-with-azure-kubernetes Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 9.0 63 KB

A demo python application used in blog Application Deployment on Azure Kubernetes Services.

Dockerfile 37.09% Python 62.91%

python-app-with-azure-kubernetes's Introduction

python-app-with-azure-kubernetes

A demo python application used in blog Application Deployment on Azure Kubernetes Services.

This repo is used in the Medium blog Application Deployment with Azure Kubernetes Service and Azure Pipelines

Steps

Create a resource group in Azure Subscription
az group create -l southcentralus -n cloudorbit-resource-grp --subscription pay-as-you-go

Create Azure k8s cluster
az aks create -g cloudorbit-resource-grp -n cloudobrit-cluster --node-vm-size Standard_B2s --node-count 2 --generate-ssh-keys

Create Azure Container Registry
az acr create -g cloudorbit-resource-grp -n cloudorbit --sku Standard

Create Azure Pipelines
Follow the steps in the blog to create and setup Azure Pipeline via Azure DevOps console

Once all done, we need to check the running pod, services and horizontal pod autoscaler

Authenticate your k8s cluster with cloud-shell
az aks get-credentials -g cloudorbit-resource-grp -n cloudobrit-cluster

Get deployments
kubectl -n dev get deployments

Get pods
kubectl -n dev get pods

Get services
kubectl -n dev get svc

Get Horizontal Pod Autoscaler
kubectl -n dev get hpa

To check the app
curl http://[external-ip]:5000

To describe pods specification and check logs
kubectl -n dev describe pods [pod-name] kubectl -n dev logs [pod-name]

We can scale our deployment manually as well as automatically. For automatic scaling, we have defined HPA in YAML which increases one replica of pod whenever the average traffic on the running pod goes beyond 80%. It will increase replica up to the max number we defined in YAML manifest that’s 3 in our case.

To manual scale
kubectl -n dev scale deployment python-app --replicas=3 kubectl -n dev get deployment python-app

For interactive UI console of k8s cluster
az aks browse -g cloudorbit-resource-grp -n cloudorbit-cluster

For entering into pods
kubectl -n dev exec -it [pod-name] -- /bin/bash

python-app-with-azure-kubernetes's People

Contributors

r4rohan avatar

Stargazers

 avatar  avatar

Watchers

 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.