Git Product home page Git Product logo

cloudinfrahomework's Introduction

Readme

This repository contains a simple Python http server which responds to GET request with a Fibonacci number. The calculation is VERY inefficient, CPU and memory consuming. Also you can find the dockerfile to build a docker image and bash scripts for kubernetes deployment.

Docker image

Docker image can be build from Dockerfile:

docker image build -t "vmaletsky/homeworkapp:v1" .

Or otherwise the image can be pulled from the docker hub:

docker pull vmaletsky/homeworkapp:v1

Start the http server:

docker run -d -p 81:81 vmaletsky/homeworkapp:v1

And start a calculation:

curl localhost:81

Kubernetes

Create Kubernetes deployment and start a service:

bash deploy.sh

This simple bash script will start Minikube, create deployment and service using deployment.yaml and service.yaml files.

After the script has finished, we can check that our service and pod are running:

kubectl get all

Now, to start our calculation we need minikube ip and nodeport:

minikube ip

>192.168.99.100
kubectl get service kubernetes-homework

NAME                  TYPE       CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
kubernetes-homework   NodePort   10.101.187.167   <none>        81:32527/TCP   2m

The port that we need is 32527. Now we can make a request to our http server:

curl 192.168.99.100:32527

After we got the result, we can delete deployment and service using cleanup script:

bash cleanup.sh

Deploy a local image

In the previous steps we used the docker image from docker hub. Now, if we want to use the local image:

bash deploy_local.sh

Liveness and readiness probes

To create the liveness and readiness probes we need first to create deployment and start the service and then:

bash liveness.sh

It will create the liveness and readiness probes from liveness_readiness.yaml, sleep for 5 seconds and show the status of the probe.

If we want to check its status at any time:

kubectl describe pod liveness-http

Memory scaling

First, we need to install Vertical Pod Autoscaler as described here.

After that, execute:

kubectl create -f vpa.yaml

Check if VPA was created and is running:

kubectl get vpa homework-vpa --output yaml

cloudinfrahomework's People

Contributors

vmaletsky avatar

Watchers

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