Git Product home page Git Product logo

kubectl-forward's Introduction

The Kubectl Socat-based Forward plugin

The kubectl-forward plugin sets up an in-cluster TCP proxy for relaying traffic to a given service running outside the cluster.

Getting Started

These instructions will get you a copy of this plugin up and running.

Installing

To install the plugin, execute the following command:

sudo curl -L https://raw.githubusercontent.com/ljakimczuk/kubectl-forward/main/bin/kubectl-forward -o /usr/local/bin/kubectl-forward
sudo chmod a+x /usr/local/bin/kubectl-forward

Usage

In order to route the traffic to the service through the cluster, pass the service address and destination port to the plugin. Optionally you are allowed to specify the source port as well, see the help output below.

Usage:
  forward [-n namespace] host [sport:]dport

Examples:
  # Forward TCP traffic to the RDS host from your local 5432 port.
  kubectl forward backend.123456789012.eu-west-1.rds.amazonaws.com 5432

  # Forward TCP  traffic the the Redis host from your local 6379 port.
  kubectl forward redis.123456789012.euw1.cache.amazonaws.com 6379

  # Forward TCP traffic to the RDS host from your local 50000 port.
  kubectl forward backend.123456789012.eu-west-1.rds.amazonaws.com 50000:5432

  # Forward TCP  traffic the the Redis host from your local 50000 port.
  kubectl forward redis.123456789012.euw1.cache.amazonaws.com 50000:6379

AWS RDS example

In order to forward traffic to the RDS backend use:

$ kubectl forward backend.123456789012.eu-west-1.rds.amazonaws.com 5432
Forwarding from 127.0.0.1:5432 -> 5432
Forwarding from [::1]:5432 -> 5432

Then use the localhost as you would do in a regular port-forwarding case, for example:

$ psql -h localhost -U postgresql -d postgres
Password for user postgresql:

AWS Redis example

In order to forward traffic to the Redis service use:

$ kubectl forward redis.123456789012.euw1.cache.amazonaws.com 6379
Forwarding from 127.0.0.1:6379 -> 6379
Forwarding from [::1]:6379 -> 6379

Then use the localhost as you would do in a regular port-forwarding case, for example:

$ redis-cli -h localhost -p 6379 --tls
localhost:6379>

kubectl-forward's People

Contributors

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