Git Product home page Git Product logo

k8s-http-router's Introduction

k8s-http-router

Warning: this project is very new and might have some issues. We have been using it successfully in our testing clusters for a couple of months. Bug reports are welcome!g

This project has been pulled from the new Gondor backend built on Kubernetes. It simply routes HTTP requests to Kubernetes services using the HTTP Host header. Additional configuration can be specified, but nothing else is currently supported.

Setup

To get k8s-http-router running on your Kubernetes cluster you can use the following replication controller:

kind: ReplicationController
apiVersion: v1beta3
metadata:
    name: router
spec:
    replicas: 3
    selector:
        name: router
    template:
        metadata:
          labels:
            name: router
        spec:
          containers:
            - name: router
              image: quay.io/eldarion/k8s-http-router
              ports:
                - name: router-http
                  containerPort: 80
                - name: router-https
                  containerPort: 443

and service:

kind: Service
apiVersion: v1beta3
metadata:
    name: router
    labels:
        name: router
spec:
    selector:
        name: router
    ports:
        - name: router-http
          port: 80
        - name: router-https
          port: 443
    createExternalLoadBalancer: true

To add a service to route, use the router annotation:

kind: Service
apiVersion: v1beta3
metadata:
    name: my-website
    labels:
        name: my-website
    annotations:
        router: '{"config": {}, "hosts": ["example.com"]}'
    spec:
        selector:
            name: my-website
        ports:
            - port: 80
              targetPort: 8000

k8s-http-router will watch for service changes and keep its internal data structures up-to-date with changes in the Kubernetes service objects.

Credit

Thanks to Google for the amazing Kubernetes project.

Thanks to the flynn project for a great router design this is inspired by, but stripped down and modified for Kubernetes.

k8s-http-router's People

Contributors

brosner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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