Giter Club home page Giter Club logo

k8s-proxy's Introduction

k8s-proxy

MIT License Beta Build status Coverage status Go Report Card Github issues Github pull requests GoDoc

This project provides a simple HTTP proxy service for easily working with multiple web services in a Kubernetes development environment. A Docker image is available.

Overview

The k8s-proxy service will serve all traffic on ports 80 and 443. SSL traffic on port 443 is encrypted using a self-signed certificate, with all of the associated issues that brings. The exposed ports are configurable in the k8s-proxy.yml file. You must set both the exposed ports in the deployment and service, as well as the K8S_PROXY_PORT and K8S_PROXY_SSLPORT environment variables in the deployment. Exposing the ports allows them to receive traffic and defining the environment variables tells the proxy service which ports to listen on.

The proxy will route traffic by matching the domain being requested to a service running in the cluster. By default, this is done based on the service name. For example a request for http://service1.any.host.here would be routed to a service named 'service1', if it exists.

That is convenient but can be cumbersom in practice. You can also map a subdomain to a particular service by applying labels to the service. All labels are optional:

kind: Service
    apiVersion: v1
    metadata:
        name: ui_backend_service
        labels:
            - k8s-proxy-scheme: https     # HTTP scheme to use when addressing this service.
            - k8s-proxy-port:   30021     # Port on the service to send traffic to.
            - k8s-proxy-domain: api.myapp # Subdomain to map this service to.

Using labels you can be sure that traffic to http://api.myapp.any.host.here and https://api.myapp.any.host.here (ssl) will be routed to your service.

Prerequisites

A properly configured and accessible Kubernetes environment and the start.sh script expects the kubectl executable to be available in the $PATH. Your kube context should be set for the intended environment before executing the script.

Getting started

Start or restart the proxy service. Listens on ports 80 and 443.

./start.sh

Or manually apply the deployment and service.

kubectl apply -f k8s-proxy.yml

Ports can be configured in the k8s-proxy.yml deployment. You must set both the container ports and the K8S_PROXY_PORT and K8S_PROXY_SSL_PORT environment variables (which inform the proxy executable which ports to bind to).

k8s-proxy's People

Contributors

mkenney avatar

Watchers

 avatar  avatar

k8s-proxy's Issues

SSL proxy does not exist

Nice to have

SSL proxy to add SSL to unencrypted services. Probably using LetsEncrypt or similar.

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.