Intro
In this post, I will be introducing you to Skupper, an open source project for enabling secure communication across Kubernetes cluster. Skupper allows your application to span multiple cloud providers, data centers, and regions. Let's see it in action!
Getting Started
aws-eu-west
and the details and reviews services in a local, on-premises cluster in namespace laptop
.- Each cluster runs two of the application services.
- An ingress route to the productpage service provides internet user access to the application.
- In the public namespace, the details and reviews proxies intercept requests for their services and forward them to the Skupper network.
- In the private namespace, the details and reviews proxies receive requests from the Skupper network and send them to the related service.
- In the private namespace, the ratings proxy intercepts requests for its service and forwards them to the Skupper network.
- In the public namespace, the ratings proxy receives requests from the Skupper network and sends them to the related service.
Prerequisites
- The
command-line tool, version 1.15 or later (installation guide)kubectl
- The
command-line tool, the latest version (installation guide)skupper
- Two Kubernetes namespaces, from any providers you choose, on any clusters you choose
- The yaml files from https://github.com/skupperproject/skupper-examples-bookinfo.git
- Two logged-in console terminals, one for each cluster or namespace
Step 1: Deploy the Bookinfo application
aws-eu-west
:$ kubectl apply -f public-cloud.yaml
service/productpage created
deployment.extensions/productpage-v1 created
service/ratings created
deployment.extensions/ratings-v1 created
laptop
:$ kubectl apply -f private-cloud.yaml
service/details created
deployment.extensions/details-v1 created
service/reviews created
deployment.extensions/reviews-v3 created
Step 2: Expose the public productpage service
aws-eu-west
:kubectl expose deployment/productpage-v1 --port 9080 --type LoadBalancer
Step 3: Observe that the application does not work
aws-eu-west
:$ echo $(kubectl get service/productpage -o jsonpath='http://{.status.loadBalancer.ingress[0].hostname}:9080')
laptop
are not reachable.Step 4: Set up Skupper
laptop
:skupper init
aws-eu-west
:skupper init
skupper status
in each console terminal to see that Skupper is available.Step 5: Connect your Skupper installations
skupper connection-token <file>
command directs Skupper to generate a secret token file with certificates that grant permission to other Skupper instances to connect to this Skupper's network.- The
command directs Skupper to connect to another Skupper's network. This step completes the Skupper connection.skupper connect <file>
laptop
may not even have an address that is reachable from the internet. After the connection is made, the Skupper network members are peers and it does not matter which Skupper opened the network port and which connected to it.scp
or a similar tool to transfer the token file to the system hosting the laptop
terminal.Generate a Skupper network connection token
aws-eu-west
:skupper connection-token ${HOME}/PVT-to-PUB-connection-token.yaml
Open a Skupper connection
laptop
:skupper connect ${HOME}/PVT-to-PUB-connection-token.yaml
Check the connection
aws-eu-west
:$ skupper status
Skupper enabled for "aws-eu-west". It is connected to 1 other sites.
laptop
:$ skupper status
Skupper enabled for "laptop". It is connected to 1 other sites.
Step 6: Virtualize the services you want shared
kubectl annotate
command to notify Skupper that a service is to be included in the Skupper network.aws-eu-west
:$ kubectl annotate service ratings skupper.io/proxy=http
service/ratings annotated
laptop
:$ kubectl annotate service details skupper.io/proxy=http
service/details annotated
$ kubectl annotate service reviews skupper.io/proxy=http
service/reviews annotated
Step 7: Observe that the application works
aws-eu-west
:$ echo $(kubectl get service/productpage -o jsonpath='http://{.status.loadBalancer.ingress[0].hostname}:9080')
Clean up
aws-eu-west
:skupper delete
kubectl delete -f public-cloud.yaml
laptop
:skupper delete
kubectl delete -f private-cloud.yaml