Skip to main content
Version: 2.0.0

Getting started with Gefyra and Colima Kubernetes

This guide will show you how to use Gefyra for the local development of a Kubernetes application running in Colima Kubernetes.


  1. Colima is available (at least in version v0.5.5)
  2. Gefyra is available (at least in version 2.0.0)

Creating a local Kubernetes cluster

1. Creating a local Kubernetes cluster with colima

colima start --kubernetes --network-address

2. Find out the network address of your VM:

colima list
default Running x86_64 2 2GiB 60GiB docker+k3s

3. Apply some workload, for example from the testing directory of this repo:

kubectl apply -f

Check out this workload running under:

Running Gefyra

1. Set up Gefyra with your Colima cluster:

gefyra up


2. Run a local Docker container with Gefyra in order to connect it with the cluster.

2.1 Build a simple Docker image with a local tag. Save the following two files in a directory on your disk.

File ./Dockerfile

FROM ubuntu
# run a server on port 8000
RUN apt update && apt install -y iproute2 iputils-ping python3 traceroute wget curl
CMD python3

File ./

import http.server
import signal
import socket
import socketserver
import sys
from datetime import datetime

if sys.argv[1:]:
port = int(sys.argv[1])
port = 8000

class MyHttpRequestHandler(http.server.SimpleHTTPRequestHandler):
def do_GET(self):
self.send_header("Content-type", "text/html")
hostname = socket.gethostname()
now = datetime.utcnow()
f"<html><body><h1>Hello from Gefyra. It is {now} on"
f" {hostname}.</h1></body></html>".encode("utf-8")

my_handler = MyHttpRequestHandler
server = socketserver.ThreadingTCPServer(("", port), my_handler)

def signal_handler(signal, frame):
if server:

signal.signal(signal.SIGINT, signal_handler)
while True:
except KeyboardInterrupt:

2.2 Build it by running docker build -f Dockerfile . -t pyserver in your directory.
2.3 Execute Gefyra's run command:
gefyra run -d -i pyserver -N mypyserver -n default

Important: gefyra run is just a wrapper for docker run (with additional flags), yet it also applies Gefyra's networking configuration to connect the container with Kubernetes. Check out the docs for gefyra run

3. 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. 🚀

4. Create a bridge to redirect the traffic from the cluster application to the one running locally:

gefyra bridge -N mypyserver -n default --ports 80:8000 --target deploy/hello-nginxdemo/hello-nginx

Check out the locally running server serving the cluster by refreshing the address from the service in Kubernetes.
It shows you a different message: Hello from Gefyra. It is .... Yes, that is really coming from your local container! 😎

5. List all running bridges:

You can list all currently active bridges with:

gefyra list --bridges

You will find all local containers that are currently linked into the cluster serving requests.

6. Unbridge the local container and reset the cluster to its original state:

gefyra unbridge --all

Check out the original response from from the service. The cluster is now reset to its inital state again.

Cleaning up

Remove Gefyra's components from the cluster and your local Docker host with:

gefyra down
  1. Remove the locally running Kubernetes cluster with
colima delete

Please provide us with your feedback

Did everything work as expected? How was the experience of using Gefyra? We'd appreciate if you could take 2 minutes of your time to fill out our feedback form.