Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Use Skupper to connect multiple Kubernetes clusters

April 20, 2021
Praveen Kumar
Related topics:
ContainersKubernetesMicroservices
Related products:
Red Hat OpenShift

Share:

    Skupper is a Layer 7 service interconnect that enables multicloud communication across Kubernetes clusters. There are a few reasons you might need to communicate between a local cluster and a remote one in development:

    • A service is deployed on the remote cluster, and you want to consume it with a local cluster.
    • A workload is high resource-consuming, and it is not feasible to deploy it on the local cluster given the available resources.
    • An existing stage/test database service is deployed on a remote cluster, and your workload needs to connect to it.

    One of the best things about Skupper is that users don’t need to have admin privileges for the cluster to deploy it. See the article Skupper.io: Let your services communicate across Kubernetes clusters for more information about the open source project.

    This article will show you how to use Skupper to connect a remote cluster service with a local cluster using Red Hat CodeReady Containers and the Developer Sandbox for Red Hat OpenShift. For a more detailed overview, refer to the Skupper getting started guide.

    About the example

    In this example, I am using Red Hat CodeReady Containers (CRC) for my local cluster. CodeReady Containers is a developer tool that lets you create local Kubernetes clusters on Red Hat OpenShift 4. I have another cluster from the Developer Sandbox for Red Hat OpenShift that I can access from anywhere.

    Step 1: Install the Skupper command-line tool

    First, install the Skupper command-line tool on your Linux system.

    Note: If you are using a different platform, refer to the instructions in the getting started guide.

    $ curl -fL https://github.com/skupperproject/skupper/releases/download/0.3.2/skupper-cli-0.3.2-linux-amd64.tgz | tar -xzf -
    
    $ sudo mv skupper /usr/local/bin
    
    $ which skupper 
    /usr/local/bin/skupper
    
    $ skupper --version
    skupper version 0.3.2
    

    Step 2: Configure access to multiple namespaces

    As the getting started guide describes, the skupper command uses the kubeconfig file and the current context to select the namespace where it operates. You must use a distinct kubeconfig or context for each namespace, so it’s best to use different console terminals, tabs, or sessions.

    Start a console session for each namespace and log in to your clusters.

    CodeReady Containers console:

    $ export KUBECONFIG=$HOME/.kube/config-crc
    
    $ oc login -u developer -p developer https://api.crc.testing:6443
    Login successful.
    
    $ oc config get-contexts
    CURRENT   NAME                              CLUSTER                AUTHINFO    NAMESPACE
    *         /api-crc-testing:6443/developer   api-crc-testing:6443   developer
    

    Developer Sandbox console:

    $ export KUBECONFIG=$HOME/.kube/config-devsandbox
    
    $ oc login --token=<token> --server=https://api.sandbox-m2.ll9k.p1.openshiftapps.com:6443
    Logged into "https://api.sandbox-m2.ll9k.p1.openshiftapps.com:6443" as "prkumar" using the token provided.
    You have access to the following projects and can switch between them with ' project <projectname>':
    * prkumar-code
    prkumar-dev
    prkumar-stage
    
    $ oc config get-contexts
    CURRENT   NAME                                                                 CLUSTER                                         AUTHINFO   NAMESPACE
    *         prkumar-code/api-sandbox-m2-ll9k-p1-openshiftapps-com:6443/prkumar   api-sandbox-m2-ll9k-p1-openshiftapps-com:6443   prkumar    prkumar-code
    

    Next, create a new project on CodeReady Containers. For this demo's purposes, we’ll use prkumar-code as the default context for the Developer Sandbox side because we don’t have permission to create a new project.

    CodeReady Containers console:

    $ oc new-project demo
    Now using project "demo" on server "https://api.crc.testing:6443".
    

    Step 3: Install the Skupper router in each namespace

    Run the skupper init command to install the router in each namespace.

    CodeReady Containers console:

    $ skupper init --cluster-local
    Skupper is now installed in namespace 'demo'.  Use 'skupper status' to get more information.

    Developer Sandbox console:

    $ skupper init
    Skupper is now installed in namespace 'prkumar-code'.  Use 'skupper status' to get more information.

    Now, check if the route is successfully installed.

    CodeReady Containers console:

    $ skupper status
    Skupper is enabled for namespace "prkumar-code" in interior mode. It is not connected to any other sites. It has no exposed services.
    

    Step 4: Connect your namespaces

    Generate the connection token.

    Developer Sandbox console:

    $ skupper connection-token $HOME/secret.yaml
    Connection token written to /home/prkumar/secret.yaml
    

    Then, use the token to connect to your CRC cluster.

    CodeReady Containers console:

    $ skupper connect $HOME/secret.yaml
    Skupper configured to connect to skupper-inter-router-prkumar-code.apps.sandbox-m2.ll9k.p1.openshiftapps.com:443 (name=conn1)

    Step 5: Expose your front-end and back-end services

    Here we will use a back-end and a front-end service, as mentioned in the getting started guide. First, we will deploy the back-end service on the Developer Sandbox and the front-end service to CRC. Then, we’ll connect the back end with the front end.

    CodeReady Containers console:

    $ oc  create deployment hello-world-frontend --image quay.io/skupper/hello-world-frontend
    deployment.apps/hello-world-frontend created
    

    Developer Sandbox console:

    $ oc create deployment hello-world-backend --image quay.io/skupper/hello-world-backend
    deployment.apps/hello-world-backend created
    

    Use the skipper expose command to expose the back-end service so it will be available on your CRC cluster.

    Developer Sandbox console:

    $ skupper expose deployment hello-world-backend --port 8080 --protocol http

    As you can see, once you expose a service using Skupper, it is visible to the CRC cluster.

    CodeReady Containers console:

    $ oc get svc
    NAME                  TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)               AGE
    
    hello-world-backend   ClusterIP   10.217.5.209   <none>        8080/TCP              96s
    

    Finally, test your front-end application to verify it can communicate with the back-end service.

    CodeReady Containers console:

    $ oc expose deployment hello-world-frontend --port 8080
    service/hello-world-frontend exposed
    
    $ oc expose svc hello-world-frontend
    route.route.openshift.io/hello-world-frontend exposed
    
    $ curl hello-world-frontend-demo.apps-crc.testing
    I am the frontend.  The backend says 'Hello from hello-world-backend-7dfb45b98d-j8q8t (2)'.
    

    Conclusion

    As we saw in this article, Skupper comes in handy when two clusters need to be connected, and CodeReady Containers provides a great local experience for OpenShift. Happy Skuppering!

    Last updated: February 5, 2024

    Recent Posts

    • Why Models-as-a-Service architecture is ideal for AI models

    • How to run MicroShift as a container using MINC

    • OpenShift 4.19 brings a unified console for developers and admins

    • 3 steps to secure network segmentation with Ansible and AWS

    • Integrate vLLM inference on macOS/iOS using OpenAI APIs

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue