Giter VIP home page Giter VIP logo

azure-kubernetes-poc's Introduction

azure-kubernetes-poc

Introduction

In this POC, We will do the following:

  1. Create an AKS cluster in Azure
  2. Deploy 2 simple services, helloworld and helloindia
  3. Create an nginx ingress controller which will route the traffic based on path, to the respective services

Architecture

aks-poc-architecture

helloworld and helloindia services

We will use the following two docker images for our POC. https://cloud.docker.com/u/spatnaik77/repository/docker/spatnaik77/helloworld https://cloud.docker.com/u/spatnaik77/repository/docker/spatnaik77/helloindia They are very simple rest APIs. helloworld returns "hello world" and helloindia returns "hello india"

Getting started with the POC

Create an aks cluster

Create an aks cluster from azure portal

Use Azure cloud shell to interact with aks cluster

Login to aks cluster using the following command:
az aks get-credentials --resource-group sidd-aks-poc-rg --name sidd-aks-poc-cluster

kubectl get nodes : Shows the node details of the cluster
NAME STATUS ROLES AGE VERSION
aks-agentpool-32009910-0 Ready agent 3h v1.11.5
aks-agentpool-32009910-1 Ready agent 3h v1.11.5
aks-agentpool-32009910-2 Ready agent 3h v1.11.5

Working with aks configuration files

Following configuration files will be used:

  • helloindia-deployment.yaml - Deployment for helloindia
  • helloindia-service.yaml - Load balancer for helloindia service
  • helloworld-deployment.yaml - Deployment for helloworld
  • helloworld-service.yaml - Load balancer for helloworld service
  • ingress.yaml - defines the routing rules for the ingress controller Upload all the config files in the cloud shell

Create the deployments & load balancer service for helloworld and helloindia

  • kubectl apply -f helloworld-deployment.yaml
  • kubectl apply -f helloworld-service.yaml
  • kubectl apply -f helloindia-deployment.yaml
  • kubectl apply -f helloindia-service.yaml

Verify the Pods & Load balancer services

  • kubectl get pods -o wide : Shows you total 6 pods (3 helloworld and 3 helloindia pods)
  • kubectl get service helloworld : Shows you details about the load balancer for helloworld pods
  • kubectl get service helloindia : Shows you details about the load balancer for helloindia pods
    Sample output:
    NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
    helloworld LoadBalancer 10.0.192.9 40.122.113.115 80:30442/TCP 4m
    siddharth@Azure:~$ kubectl get service helloindia
    NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
    helloindia LoadBalancer 10.0.57.94 40.122.49.235 80:31822/TCP 4m

Create nginx ingress controller

  • helm init

  • helm install stable/nginx-ingress --namespace kube-system --set controller.replicaCount=2 --set rbac.create=false

  • Verify the ingress controller just created kubectl get service -l app=nginx-ingress --namespace kube-system Sample output
    NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
    wistful-pig-nginx-ingress-controller LoadBalancer 10.0.237.242 40.122.106.243 80:32173/TCP,443:30315/TCP 1m
    wistful-pig-nginx-ingress-default-backend ClusterIP 10.0.161.4 80/TCP 1m

  • try accessing the external ip: http://40.122.106.243 - You should see this message - "default backend 404"

Create nginx ingress route for routing the traffic to helloworld & helloindia service based on their path

kubectl apply -f ingress.yaml

Test the application:

Kubernetes Dashboard

az aks browse --resource-group sidd-aks-poc-rg --name sidd-aks-poc-cluster

azure-kubernetes-poc's People

Contributors

spatnaik77 avatar

Watchers

James Cloos avatar cutezjz avatar  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.