vvvityaaa / gefyra

Blazingly-fast :rocket:, rock-solid, local application development :arrow_right: with Kubernetes.

Home Page:https://gefyra.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Contributors Forks Stargazers Issues MIT License


Gefyra Logo

Gefyra

Blazingly-fast, rock-solid, local application development with Kubernetes!
Explore the docs »

Try it yourself · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Why "Gefyra"
  4. License
  5. Acknowledgments

About the project

Gefyra gives Kubernetes-("cloud-native")-developers a completely new way of writing and testing their applications. Gone are the times of custom docker-compose setups, Vagrants, custom scripts or other scenarios in order to develop (micro-)services for Kubernetes.

Gefyra offers you to:

  • run services locally on a developer machine
  • operate feature-branches in a production-like Kubernetes environment with all adjacent services
  • write code in the IDE you already love, be fast, be confident
  • leverage all the neat development features, such as debugger, code-hot-reloading, overriding environment variables
  • run high-level integration tests against all dependent services
  • keep peace-of-mind when pushing new code to the integration environment

(back to top)

Built with

Gefyra builds on top of the following popular open-source technologies:

Docker

Docker is currently used in order to manage the local container-based development setup, including the host, networking and container management procedures.

Wireguard

Wireguard is used to establish the connection tunnel between the two ends. It securely encrypts the UDP-based traffic and allows to create a site-to-site network for Gefyra. That way, the development setup becomes part of the cluster and containers running locally are actually able to reach cluster-based resources, such as databases, other (micro)services and so on.

CoreDNS

CoreDNS provides local DNS functionality. It allows resolving resources running within the Kubernetes cluster.

Nginx

Nginx is used for all kinds of proxying and reverse-proxying traffic, including the interceptions of already running containers in the cluster.

Rsync

Rsync is used to synchronize directories from containers running in the cluster to local instances. This is particularly important for Kubernetes service account tokens during a bridge operation.

(back to top)

Getting Started

You can easily try Gefyra yourself following this small example.

Prerequisites

  1. Follow the installation for your preferred platform.

  2. Create a local Kubernetes cluster with k3d like so:
    < v5 k3d cluster create mycluster --agents 1 -p 8080:80@agent[0] -p 31820:31820/UDP@agent[0]
    >= v5 k3d cluster create mycluster --agents 1 -p 8080:80@agent:0 -p 31820:31820/UDP@agent:0
    This creates a Kubernetes cluster that binds port 8080 and 31820 to localhost. kubectl context is immediately set to this cluster.

  3. Apply some workload, for example from the testing directory of this repo:
    kubectl apply -f testing/workloads/hello.yaml Check out this workload running under: http://hello.127.0.0.1.nip.io:8080/

Running Gefyra

  1. Set up Gefyra with gefyra up
  2. Run a local Docker image with Gefyra in order to make it part of the cluster.
    a) Build your Docker image with a local tag, for example from the testing directory:
    cd testing/images/ && docker build -f Dockerfile.local . -t pyserver
    b) Execute Gefyra's run command:
    gefyra run -i pyserver -N mypyserver -n default
    c) Exec into the running container and look around. You will find the container to run within your Kubernetes cluster.
    docker exec -it mypyserver bash
    wget -O- hello-nginx will print out the website of the cluster service hello-nginx from within the cluster.
  3. Create a bridge in order to intercept the traffic to the cluster application with the one running locally:
    gefyra bridge -N mypyserver -n default --deployment hello-nginxdemo --port 80:8000 --container-name hello-nginx -I mypybridge
    Check out the locally running server comes up under: http://hello.127.0.0.1.nip.io:8080/
  4. List all running bridges:
    gefyra list --bridges
  5. Unbridge the local container and reset the cluster to its original state: gefyra unbridge -N mypybridge Check out the initial response from: http://hello.127.0.0.1.nip.io:8080/

Cleaning up

  1. Remove Gefyra's components from the cluster with gefyra down
  2. Remove the locally running Kubernetes cluster with k3d cluster delete mycluster

(back to top)

Usage

The following actions are available in Gefyra's CLI:

  • up: setup local development infrastructure
  • run: deploy a new app container into the cluster
  • bridge: intercept the traffic to a container that's running in the cluster and send it to the development container
  • unbridge: remove active traffic intercepts and reset the cluster to its original state
  • down: remove Gefyra's development infrastructure
  • list: list running containers and active bridges
  • check: check local system dependencies
  • version: print the current version and exit

For more examples, please refer to the Documentation

(back to top)

Why "Gefyra"

"Gefyra" is the Greek word for "Bridge" and fits nicely with Kubernetes' nautical theme.

(back to top)

License

Distributed under the Apache License 2.0. See LICENSE for more information.

(back to top)

Acknowledgments

Gefyra is based on well-crafted open source software. Special credits go to the teams of https://www.linuxserver.io/ and https://git.zx2c4.com/wireguard-go/about/. Please be sure to check out their awesome work.
Gefyra was heavily inspired by the free part of Telepresence2.

Doge is excited about that.

Doge is excited

(back to top)

About

Blazingly-fast :rocket:, rock-solid, local application development :arrow_right: with Kubernetes.

https://gefyra.dev

License:Apache License 2.0


Languages

Language:Python 82.9%Language:Dockerfile 8.6%Language:Starlark 5.6%Language:Shell 3.0%