Git Product home page Git Product logo

assessment's Introduction

Kubernetes cluster for sample python project

This repo is for sample python containerise project provision via K8s on minikube, Repo consist of:

  1. Sample python code for hello-world that uses Flask (HTTP server for app).
  2. Docker file to launch container with base alpine image for python 3.7.
  3. K8s declarative configuration file to run 2 replica of app via deployment object,which are exposed internally to other objects via cluster-ip service on port 5000.
  4. External traffic allowed via Ingress service with configuration available in ingress-service.yaml.

Installation

This project require minikube and kubectl configured. I am using community led project for ingress-nginx setup available on https://github.com/kubernetes/ingress-nginx To make use on community led NGINX Ingress controller there are some mandatory configuration require. If you already have minikube and kubectl configured.

Follow instruction:-

  1. Below command will create Namespaces, configmap, serviceaccount, clusterrole and deployment for nginx-ingress-controller.

    Run: kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/mandatory.yaml Run: minikube addons enable ingress

  2. Once configured code copied. Run command from project root folder.

    Run: kubectl apply -f k8s

  3. To access Hello world app please hit minikube IP address. Ip address available via command 'minkube ip'

Configuration discussed:

1.Docker file to launch container with base alpine image for python 3.7:

Base alpine image of python 3.7 get downloaded from docker hub. Additional requirement to run the project get installed and default command has been changeed.

2.Deployment object to run 2 replica of sample application:

Post docker build, updated image get pushed into docker hub. Instructions are shared in deploy.sh. Deployment object pythapp-deployment.yaml is configured to run 2 replicas of the image shared on docker hub.

3.ClusterIp service to expose pod to internal objects on port 5000, configuration availlable on pythapp-cluster-ip-service.yaml.

4.To allow traffic externally Ingress-nginx service object has been created with configuration available on ingress-service.yaml.

assessment's People

Contributors

rsharma08 avatar

Watchers

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