GithubHelp home page GithubHelp logo

sivasenthil3095 / k8s-wordsmith-demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dockersamples/wordsmith

0.0 0.0 0.0 290 KB

Sample project with Docker containers running under Kubernetes

License: Apache License 2.0

JavaScript 13.71% Java 25.21% Go 15.87% CSS 22.15% HTML 16.39% Dockerfile 6.66%

k8s-wordsmith-demo's Introduction

Kubernetes Wordsmith Demo

Wordsmith is the demo project shown at DockerCon EU 2017 and 2018.

The demo app runs across three containers:

  • db - a Postgres database which stores words

  • words - a Java REST API which serves words read from the database

  • web - a Go web application which calls the API and builds words into sentences:

Build and Run in Docker Compose

The only requirement to build and run the app from source is Docker. Clone this repo and use Docker Compose to build all the images. You can use the new V2 Compose with docker compose or the classic docker-compose CLI:

docker compose up --build

Or you can pull pre-built images from Docker Hub using docker compose pull.

Deploy Using a Kubernetes Manifest

You can deploy the same app to Kubernetes using the Kubernetes manifest. That describes the same application in terms of Kubernetes deployments, services and pod specifications.

Apply the manifest using kubectl:

kubectl apply -f kube-deployment.yml

Now browse to http://localhost:8081 and you will see the same site.

Docker Desktop includes Kuernetes and the kubectl command line, so you can work directly with the Kube cluster. Check the services are up, and you should see output like this:

$ kubectl get svc
NAME         TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
db           ClusterIP      None             <none>        55555/TCP        2m
kubernetes   ClusterIP      10.96.0.1        <none>        443/TCP          38d
web          LoadBalancer   10.107.215.211   <pending>     8080:30220/TCP   2m
words        ClusterIP      None             <none>        55555/TCP        2m

Check the pods are running, and you should see one pod each for the database and web components, and five pods for the words API - which is specified as the replica count in the compose file:

$ kubectl get pods
NAME                   READY     STATUS    RESTARTS   AGE
db-8678676c79-h2d99    1/1       Running   0          1m
web-5d6bfbbd8b-6zbl8   1/1       Running   0          1m
words-858f6678-6c8kk   1/1       Running   0          1m
words-858f6678-7bqbv   1/1       Running   0          1m
words-858f6678-fjdws   1/1       Running   0          1m
words-858f6678-rrr8c   1/1       Running   0          1m
words-858f6678-x9zqh   1/1       Running   0          1m

Then browse to http://localhost:8080 to see the site. Each time you refresh the page, you'll see a different sentence generated by the API calls.

k8s-wordsmith-demo's People

Contributors

bretfisher avatar otherguy avatar sixeyed avatar manomarks avatar alexandreroman avatar johnharris85 avatar estesp avatar dependabot[bot] 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.