layout | title | permalink | nav_order |
---|---|---|---|
page |
Try it yourself |
/try-it-out/ |
5 |
You can easily try Gefyra yourself following this small example. {: .fs-6 .fw-300 }
-
Follow the installation for your preferred platform.
-
Create a local Kubernetes cluster with
k3d
like so:
< v5k3d cluster create mycluster --agents 1 -p 8080:80@agent[0] -p 31820:31820/UDP@agent[0]
>= v5k3d 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. -
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/
- Set up Gefyra with
gefyra up
- Run a local Docker image with Gefyra in order to make it part of the cluster.
- Build your Docker image with a local tag, for example from the testing directory:
cd testing/images/ && docker build -f Dockerfile.local . -t pyserver
- Execute Gefyra's run command:
gefyra run -i pyserver -N mypyserver -n default
- 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.
- Build your Docker image with a local tag, for example from the testing directory:
- 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/ - List all running bridges:
gefyra list --bridges
- 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/
- Remove Gefyra's components from the cluster with
gefyra down
- Remove the locally running Kubernetes cluster with
k3d cluster delete mycluster