Git Product home page Git Product logo

k8s-word-demo's Introduction

Kubernetes Words Demo

Words is the demo project on k8s.

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:

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:// and you will see the same site.

Check the services are up, and you should see output like this:

$ kubectl get svc
NAME         TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
words-api    ClusterIP      172.31.0.65      <none>        8080/TCP         4s
words-db     ClusterIP      172.31.0.243     <none>        5432/TCP         4s
words-web    LoadBalancer   172.31.0.58      192.168.0.9   80:30220/TCP     3s

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
words-api-9787944d6-f544j    1/1     Running   0          6s
words-api-9787944d6-fdczp    1/1     Running   0          6s
words-api-9787944d6-q4rdc    1/1     Running   0          6s
words-api-9787944d6-qqzb5    1/1     Running   0          6s
words-api-9787944d6-vbcn4    1/1     Running   0          6s
words-db-cc96d879d-fmzqk     1/1     Running   0          6s
words-web-69dbfc57cb-rlprp   1/1     Running   0          6s

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

k8s-word-demo's People

Contributors

gyj0825 avatar

Watchers

James Cloos avatar  avatar

Forkers

sapphirelin

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.