Code Monkey home page Code Monkey logo

k8s-multi-tier's Introduction

Deploying a Multi-Tier Application

The application consists of a backend database and a frontend. For the backend, we will be using a MongoDB database, and for the frontend, we have a Python Flask-based application.

Deploy the Mongo database

First we create a deployment for Mongo database. After we create a service. We use the default ClusterIP ServiceType. This means that the mongodb Service will not be accessible from the external world.

kubectl create namespace testing-jsayar

kubectl create -f rsvp-db-deployment.yaml

kubectl create -f rsvp-db-service.yaml

Deploy the Python Flask-Based Frontend

The frontend is created using a Python Flask-based microframework. Its source code is available here. There are a Docker image called teamcloudyuga/rsvpapp, in which the application's source code is imported. The application's code is executed when a container created from that image runs. The Dockerfile to create the teamcloudyuga/rsvpapp image is available here.

While creating the Deployment for the frontend, we are passing the name of the MongoDB Service, mongodb, as an environment variable, which is expected by our frontend.

Notice that in the ports section we mentioned the containerPort 5000, and given it the web-port name. We will be using the referenced web-port name while creating the Service for the rsvp application. This is useful, as we can change the underlying containerPort without making any changes to our Service.

kubectl create -f rsvp-web-deployment.yaml

kubectl create -f rsvp-web-service.yaml

Check Out the Available Deployments and Services

kubectl get deployments

kubectl get services

Scale the Frontend

kubectl scale --replicas=4 -f /tmp/rsvp-web.yaml

k8s-multi-tier's People

Contributors

jesus-sayar 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.