This example is part of a suite of examples showing the different ways you can use Skupper to connect services across cloud providers, data centers, and edge sites.
- Overview
- Prerequisites
- Step 1: Access your Kubernetes clusters
- Step 2: Create your Kubernetes namespaces
- Step 3: Install Skupper on your Kubernetes clusters
- Step 4: Install the Skupper command-line tool
- Step 5: Create your sites
- Step 6: Link your sites
- Step 7: Deploy the iperf3 servers
- Step 8: Create connectors for the iperf3 servers
- Step 9: Create listeners for the iperf3 services
- Step 10: Run benchmark tests across the clusters
- Cleaning up
- Next steps
- About this example
This tutorial demonstrates how to perform real-time network throughput measurements across Kubernetes using the iperf3 tool. In this tutorial you:
- deploy iperf3 in two separate clusters
- run iperf3 client test instances
-
The
kubectlcommand-line tool, version 1.15 or later ([installation guide][install-kubectl]) -
Access to two clusters to observe performance. As an example, the two clusters might consist of:
-
A private cloud cluster running on your local machine (east)
-
A public cloud cluster running in a public cloud provider (west)
Skupper is designed for use with multiple Kubernetes clusters.
The skupper and kubectl commands use your
kubeconfig and current context to select the cluster
and namespace where they operate.
This example uses multiple cluster contexts at once. The
KUBECONFIG environment variable tells skupper and kubectl
which kubeconfig to use.
For each cluster, open a new terminal window. In each terminal,
set the KUBECONFIG environment variable to a different path and
log in to your cluster.
West:
export KUBECONFIG=~/.kube/config-west
<provider-specific login command>East:
export KUBECONFIG=~/.kube/config-east
<provider-specific login command>Note: The login procedure varies by provider.
The example application has different components deployed to different Kubernetes namespaces. To set up our example, we need to create the namespaces.
For each cluster, use kubectl create namespace and kubectl config set-context to create the namespace you wish to use and
set the namespace on your current context.
West:
kubectl create namespace west
kubectl config set-context --current --namespace westEast:
kubectl create namespace east
kubectl config set-context --current --namespace eastUsing Skupper on Kubernetes requires the installation of the Skupper custom resource definitions (CRDs) and the Skupper controller.
For each cluster, use kubectl apply with the Skupper
installation YAML to install the CRDs and controller.
West:
kubectl apply -f https://skupper.io/v2/install.yamlEast:
kubectl apply -f https://skupper.io/v2/install.yamlThis example uses the Skupper command-line tool to create Skupper
resources. You need to install the skupper command only once
for each development environment.
On Linux or Mac, you can use the install script (inspect it here) to download and extract the command:
curl https://skupper.io/v2/install.sh | shThe script installs the command under your home directory. It prompts you to add the command to your path if necessary.
For Windows and other installation options, see Installing Skupper.
A Skupper site is a location where your application workloads are running. Sites are linked together to form a network for your application.
For each namespace, use skupper site create with a site name of
your choice. This creates the site resource and deploys the
Skupper router to the namespace.
Note: If you are using Minikube, you need to start minikube
tunnel before you run skupper site create.
West:
skupper site create west --enable-link-accessSample output:
$ skupper site create west --enable-link-access
Waiting for status...
Site "west" is configured. Check the status to see when it is readyEast:
skupper site create east --enable-link-accessSample output:
$ skupper site create east --enable-link-access
Waiting for status...
Site "east" is configured. Check the status to see when it is readyYou can use skupper site status at any time to check the status
of your site.
A Skupper link is a channel for communication between two sites. Links serve as a transport for application connections and requests.
Creating a link requires the use of two Skupper commands in
conjunction: skupper token issue and skupper token redeem.
The skupper token issue command generates a secret token that
can be transferred to a remote site and redeemed for a link to the
issuing site. The skupper token redeem command uses the token
to create the link.
Note: The link token is truly a secret. Anyone who has the token can link to your site. Make sure that only those you trust have access to it.
First, use skupper token issue in West to generate the token.
Then, use skupper token redeem in East to link the sites.
West:
skupper token issue ~/east-to-west.tokenEast:
skupper token redeem ~/east-to-west.tokenIf your terminal sessions are on different machines, you may need
to use scp or a similar tool to transfer the token securely. By
default, tokens expire after a single use or 15 minutes after
being issued.
After creating the application router network, deploy iperf3 in each namespace.
East:
kubectl apply -f deployment-iperf3-a.yamlWest:
kubectl apply -f deployment-iperf3-b.yamlWith Skupper v2, connectors run in the namespace where the workload is deployed. Create a connector for each iperf3 server so the application network can reach the pods.
East:
skupper connector create iperf3-server-a 5201 --workload deployment/iperf3-server-aWest:
skupper connector create iperf3-server-b 5201 --workload deployment/iperf3-server-bListeners create service endpoints in each namespace so clients can reach those connectors. Configure listeners for every iperf3 service in each namespace.
East:
skupper listener create iperf3-server-a 5201
skupper listener create iperf3-server-b 5201West:
skupper listener create iperf3-server-a 5201
skupper listener create iperf3-server-b 5201After deploying the iperf3 servers into the private and public cloud clusters, the virtual application network enables communications even though they are running in separate clusters.
East:
kubectl exec $(kubectl get pod -l application=iperf3-server-a -o=jsonpath='{.items[0].metadata.name}') -- iperf3 -c iperf3-server-a > results/east-to-a.log
kubectl exec $(kubectl get pod -l application=iperf3-server-a -o=jsonpath='{.items[0].metadata.name}') -- iperf3 -c iperf3-server-b > results/east-to-b.logWest:
kubectl exec $(kubectl get pod -l application=iperf3-server-b -o=jsonpath='{.items[0].metadata.name}') -- iperf3 -c iperf3-server-a > results/west-to-a.log
kubectl exec $(kubectl get pod -l application=iperf3-server-b -o=jsonpath='{.items[0].metadata.name}') -- iperf3 -c iperf3-server-b > results/west-to-b.log
skupper debug dumpTo remove Skupper and the other resources from this exercise, use the following commands.
East:
kubectl delete deployment iperf3-server-a
skupper deleteWest:
kubectl delete deployment iperf3-server-b
skupper deleteThis example was produced using Skewer, a library for documenting and testing Skupper examples.
Skewer provides utility functions for generating the README and
running the example steps. Use the ./plano command in the project
root to see what is available.
To quickly stand up the example using Minikube, try the ./plano demo
command.