Code Monkey home page Code Monkey logo

example-voting-k8s's Introduction

Example Voting App

Manual Docker Image Build & Push

Login on Docker

docker login

Creating Image

docker build -t example-voting-app .                                            

Tagging Image

docker tag example-voting-app <your-docker-username>/example-voting-app:latest

Pushing Image

docker push <your-docker-username>/example-voting-app:latest                        

Running app locally

To run the app locally, first run Minikube:

minikube start

Then create all vote resources needed:

kubectl apply -f k8s/vote/

Populating database

After postgres pod is running, run the following command to populate the database:

kubectl exec -it <pod db name> -- psql -U postgres

access votedb

\c votedb

populate table

INSERT INTO votes
(id, quantity, "name")
VALUES(1, 0, 'cat');

INSERT INTO votes
(id, quantity, "name")
VALUES(2, 0, 'dog');

Files

vote-deployment : Deployment of the vote app with pod configuration

vote-service : NodePort service to connect to the app outside of the cluster.

vote-database : Postgres Database of App

vote-service : ClusterIP to connect vote pod with database

Utilities Commands

Get all pods

kubectl get pods

Describe cluster services (showing the IP of the services)

kubectl describe services

Get the URL of the vote service (call access the app outside of cluster)

 minikube service vote

Get the logs of a pod

kubectl logs pod-name

Architecture Draw

Requirements

example-voting-k8s's People

Contributors

vinigmoraes avatar

Watchers

Lucian 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.