Giter Club home page Giter Club logo

kura-database-assignment's Introduction

Database Assignment with MongoDB

1. Goal:

The goal for this assignment is to deploy an application locally (local computer is the host) using kubernetes.
The application has a database. The user will interact with the front-end in order to input or read data stored in the database.
The database is set up so that the front-end authenticate before accessing the back-end (wich is the database in this case).

2. Architecture:

3. Software tools used:

We avoid using a cloud provider for the deployment for cost purposes.
This is not used in a production environment.

4. Procedure:

Note: Avoid pasting the $ sign; it is not part of the commands. The sign shows up when you use Linux.

  1. Create a cluster with a loadbalancer with port mapping โ€œ8080:8081โ€
k3d cluster create mycluster -p "8080:8081@loadbalancer"

You should see:

  • port 8080 is for the access to the front-end.
  • port 8081 is for the access to the application
  • port 27017 is the port open in order to access the database
  1. Encode the username and password and put it in the secret.yaml file.
    In the command line, type this:
$ echo -n mongo-root-username | base64

Output: bW9uZ28tcm9vdC11c2VybmFtZQ==

Then, do the same for the password:

$ echo -n mongo-root-password | base64

Output: bW9uZ28tcm9vdC1wYXNzd29yZA==

  1. Create the yaml files in your working directory.

  1. Now, run these commands in the order they are given.
$ kubectl apply -f secret.yaml

$ kubectl apply -f mongo-deploy.yaml

$ kubectl apply -f config_map.yaml

$ kubectl apply -f mongo-express.yaml

  1. Verfy that the pods are running:
$ kubectl get pod

  1. Verify that the app is working by typing to the url:
localhost:8080

Source:

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.